Fork me on GitHub

I think I ran into a use case for which there's no syntax I want a restore_cache cache key that will last 24h. Rationale being, I don't want to spam an API provider with one request per build. But a permament cache wouldn't be useful either since the API's results can change over time. This is the section that describes the possible syntaxes:


the Environment choice would almost cut it


but it needs fiddling with contexts


perhaps you can use the current date as part of the key...?


yes, that's what I'm seeking but circle's syntax seemingly doesn't allow to embed the output of an arbitrary command there


a few things could work for me: * ability to use the output of arbitrary commands * allow vanilla env vars, not from contexts * add something akin to epoch, just not so fine-grained


The easiest way around that is to echo the output into a file and then use the checksum of that file.

👆 3
💡 2

I gave it a think and it doesn't sound like it would work for my use case. I need to cache an internal cache dir (this API uses such a cache locally), not a result set. The API itself must be called in every run; caching results would be incorrect In any case I'd really appreciate the declarativeness of saying "dir foo should be cached for 1 day"


@vemv you can use multiple parts in a key so you could make the key based on dir foo + a file where you write the current date?

👀 2

@borkdude that worked! and it's pretty thin. might have been what @conormcd suggested? Not sure if I was interpreting incorrectly what he said. Either way thank you both!

👍 2