But then you can’t control actual age of cache. I could use something like modulus of time.Unix, but it is not precise. It only creates timeframes.
The opposite way seems more viable. I can set maxAge globally to reasonable value and set cache key to something like $url+forever for images. And it won’t be creating as much cache files.
Thank you for pushing me into the right direction.
well, turns out that it is not working as intended. When I set maxAge to 60 and then override this with custom cache key, all resources are downloaded each build.
I’m not sure if this would solve your particular problem, but you could have a look at
You could e.g. enable the HTTP cache behaviour for your JSON resources, which would effectively override what’s defined in the file cache (if the file has changed, it gets evicted).
Thank you so much! Now it seems to work. I have set maxAge to -1 and enabled HTTP cache behavior for JSON. So images are cached forever even without keys. And JSON is respecting cache-control headers (I guess?)