Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to geep cache alive until the provided function does not throw? #92

Closed
aalexgabi opened this issue Dec 8, 2017 · 2 comments
Assignees

Comments

@aalexgabi
Copy link

aalexgabi commented Dec 8, 2017

For example I want to keep a cache that avoids executing a db query but I want that the cache is still available if db is down.

  1. Call memoized function that returns db a value
  2. Db goes down
  3. Cache expires
  4. Call memoized function that tries to query db which fails but still return the old value from the cache instead of failing

The idea is that sometimes is desirable to have an older value instead of failing.

@medikoo medikoo self-assigned this Dec 8, 2017
@medikoo
Copy link
Owner

medikoo commented Dec 8, 2017

@aalexgabi it is planned to be provided with v1.

See description of invalidationSpan option at ttl section in #73

@medikoo medikoo closed this as completed Dec 8, 2017
@aalexgabi
Copy link
Author

@medikoo Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants