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

Why does @Cacheable not support configuring expiration time? #27851

Closed
icankeep opened this issue Dec 23, 2021 · 1 comment
Closed

Why does @Cacheable not support configuring expiration time? #27851

icankeep opened this issue Dec 23, 2021 · 1 comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@icankeep
Copy link

hello,
I have some confusion when using spring-cache
For example, when I use method's caching, I hope the results can be cached and the cache expires regularly. Now @Cacheable doesn't seem to support it. If I want to do this, I need to write some code. I don't know why doesn't Spring support cache expiration? It would be even better if it could support scheduled refresh, which could help me reduce some development time and avoid introducing other additional dependencies

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 23, 2021
@snicoll
Copy link
Member

snicoll commented Dec 24, 2021

This is covered in the reference guide. The cache abstraction isn't an abstraction on how the cache can be configured, it wouldn't be wise to try to do that anyway.

If you need expiry on your cache, choose a cache provider that supports this feature and configure it accordingly.

@snicoll snicoll closed this as completed Dec 24, 2021
@snicoll snicoll added for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

3 participants