Expiry of old results
See original GitHub issueI’ve added a small extra feature that recalculates if a result is older than a certain age.
@memory.cache(expires_after=60)
def f(x):
...
Will recompute if cached result is older than 60 seconds. Code is in this branch: https://github.com/fredludlow/joblib/tree/expires-after
Is this of interest? And if so, is there anything else that needs doing before sending a pull request? (I’ve added test coverage in test_memory.py)
Issue Analytics
- State:
- Created 8 years ago
- Reactions:29
- Comments:25 (9 by maintainers)
Top Results From Across the Web
Are Your COVID Tests Expired? Here's How to Find ... - CNET
Generally, the FDA authorizes at-home test kits with a shelf life of about four to six months, but that shelf life could be...
Read more >Do at-home COVID tests expire? - SingleCare
At-home COVID-19 tests have an expiration date. Expired COVID tests can be used but results should be confirmed with a non-expired test or...
Read more >Do Expired COVID-19 Rapid Tests Work? Experts Explain ...
After health officials expanded expiration dates for COVID-19 tests, you may wonder about using expired tests. Here's what experts say about ...
Read more >At-Home COVID-19 Diagnostic Tests: Frequently Asked ... - FDA
Q: Can the expiration date of an at-home COVID-19 diagnostic test be extended? (4/28/22). A: Yes. Once the test manufacturer has more stability...
Read more >Can you still use an at-home COVID-19 test past its expiration ...
The Food and Drug Administration has advised against using at-home COVID-19 tests beyond their expiration dates, warning that expired test kits ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is this feature in the pipline for release?
Totally agree with the philosophy of keeping it as unsurprising as possible - this wouldn’t break any existing code and the default would be to behave exactly as before.
My use case is a web app which aggregates data from a bunch of components (SQL queries and remote web APIs) and returns a bundle of data to the client. A non-cached request for this project takes maybe 10 seconds. If you use an http cache (requests_cache) that reduces to 5 seconds.If I put joblib caching around each component (there are about 10) then that reduces to miliseconds for second and subsequent calls.
I’m happy with serving up results that are, at most, a week old (the quickest changing data sources I’m using update on that timescale) but not happy with caching “forever” (the current joblib model). Without this modification my options are:
Set-up a cron job to clear caches every week - this breaks portability of the app (adds another installation/uninstallation step).
Build the cache maintenance into the request cycle either in a very broad-brushed way (delete the whole lot if root cache_dir > max_age) or per result (what this change does).
Joblib has been great for this during development because small changes to one component don’t cause a complete recalculation of the whole bundle, so the “Page Broken” --> “Make a change” --> “Hit F5” --> “Wait…” cycle is minimized.
Of course it’s your decision, if it’s not right for joblib then close this issue. Also if you think I’m going about this wrong and there’s a better way of doing it I’d be very happy to hear it - I couldn’t see any other similar library that provides this functionality, though maybe that’s because it’s a silly way to solve the problem!)