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

DefaultCacheDurationSeconds is not being honored #121

Closed
hermesramos opened this issue Jul 4, 2020 · 1 comment
Closed

DefaultCacheDurationSeconds is not being honored #121

hermesramos opened this issue Jul 4, 2020 · 1 comment
Labels

Comments

@hermesramos
Copy link

hermesramos commented Jul 4, 2020

Describe the bug
DefaultCacheDurationSeconds is not being honored.

To Reproduce
public static readonly IAppCache CachingService = new CachingService { DefaultCachePolicy = new CacheDefaults { DefaultCacheDurationSeconds = 1 } };

Even though duration is set to 1 second (this time frame is for testing purpose), no cache entry is being evicted.

Expected behavior
Evict all cache entries after 1 second.

** Framework and Platform

  • OS: Windows 10
  • Framework: netcoreapp3.1
  • LazyCache Version: 2.0.4
@hermesramos hermesramos added the bug label Jul 4, 2020
@hermesramos hermesramos changed the title DefaultCacheDurationSeconds not being honored DefaultCacheDurationSeconds is not being honored Jul 4, 2020
@alastairtree
Copy link
Owner

By default cache eviction is lazy for performance reasons - eviction is only triggered on the next time the item is accessed. So even though an expired item is still in the cache it will not be used, and eviction will be triggered next time you try and access it, and any post eviction callbacks will fire then. If required you can force immediate expiration using ExpirationMode in LazyCache 2.1, see the expiration mode section of the docs for more info.

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

No branches or pull requests

2 participants