cacache
cacache copied to clipboard
Replacing stale content
I am using cacache with make-fetch-happen to cache fetch responses from a forecast API. These responses are pretty big (~60 kB) and differ every hour.
What worries me a little bit is the fact that stale responses are kept by default. I expected the stale response to be replaced by the fresh one if the key matches.
I've investigated the documentation thoroughly and the closest thing I've found is calling rm.content
just before put
ting new one.
Is this the right thing to do? Have I overlooked something? What is the reason for keeping stale responses by default? Is purging stale responses out of the scope of this library? If this is generally accepted cache behavior, can you please point me to some explanation?
Thank you.
I'm facing a similar issue, isn't there any form of expiration or something similar in this library?
I don't think so. I settled up with deleting cache manually using cron.