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

ability to auto-refresh Cache on schedule before it expires #794

Closed
MNF opened this issue Sep 12, 2020 · 7 comments
Closed

ability to auto-refresh Cache on schedule before it expires #794

MNF opened this issue Sep 12, 2020 · 7 comments
Labels
stale Stale issues or pull requests

Comments

@MNF
Copy link

MNF commented Sep 12, 2020

It will be good to have an ability to auto-refresh Cache on schedule before it expires similar as It is asked in https://stackoverflow.com/questions/44723017/in-memory-caching-with-auto-regeneration-on-asp-net-core and https://stackoverflow.com/questions/56412143/lazycache-regularly-refresh-cached-items

Describe your proposed or preferred solution:
Add optional Action<Context, string> onCacheExpired or

Action<Context, string> onCacheAboutToExpire and configuration aboutToExpireTimespan ( e.g. to start action 1 min before cache is expired)

Similar idea was discussed by @phatcher in #648 (comment)

@phatcher
Copy link

@jackbond Issue with refreshing pre-emptively is that your cache grows monotonically i.e. you never remove anything from the cache. You might also need a cache counter so you only pre-emptively load if the item is frequently used.

The multi-second first hit can't typically be avoided since you might need the latest.

I'm about to hit this sort of stuff again on my project so I'll provide some feedback here once I have a result

@github-actions
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

@github-actions github-actions bot added the stale Stale issues or pull requests label Jul 18, 2023
@martincostello
Copy link
Member

This is a feature we're unlikely to build into future releases of Polly.

A more likely scenario is a package that builds on top of the .NET caching functionality might be made available (see #1127) where such functionality would be associated with the cache itself and Polly would itself not need to concern itself with any optimistic re-hydration of the cache.

@martincostello martincostello removed the stale Stale issues or pull requests label Jul 18, 2023
@github-actions
Copy link
Contributor

This issue is stale because it has been open for 60 days with no activity. It will be automatically closed in 14 days if no further updates are made.

@github-actions github-actions bot added the stale Stale issues or pull requests label Sep 17, 2023
@martincostello martincostello closed this as not planned Won't fix, can't repro, duplicate, stale Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues or pull requests
Projects
None yet
Development

No branches or pull requests

4 participants
@phatcher @MNF @martincostello and others