-
Notifications
You must be signed in to change notification settings - Fork 160
Clear or loop #122
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
Comments
You cannot iterate the keys in the underlying MemoryCache reliably because the list of keys and items are continually changing as items are added/removed/expire. The list is likely to change during iteration. It is also an expensive operation and is generally a code smell as there are usually ways to avoid the need to clear the entire cache. But if you must clear everything see the docs https://github.com/alastairtree/LazyCache/wiki/API-documentation-(v-2.x)#empty-the-entire-cache |
If needed I ported a dll library over to .netstandard 2.0 (where lazy cache is utilized), but needed the keys within .net framework 4.7.2 web application. within the .netstandard 2.0:
Then call the GetAllCacheEntries method within your .net standard library from the framework application and loop through as needed. |
Hello.
I found method to clear all cache: productCache.CacheProvider.Dispose(); (#6 where is ObjectCache object?)
but... what about loop existing keys ? I found this: https://stackoverflow.com/questions/8023543/can-i-iterate-over-the-net4-memorycache.
If i can get instanceIMemoryCache with this is possible:
#56
https://stackoverflow.com/questions/45597057/how-to-retrieve-a-list-of-memory-cache-keys-in-asp-net-core
Implmentation for lazy?
Thx
The text was updated successfully, but these errors were encountered: