Closed QuantumToasted closed 1 year ago
Hello @QuantumToasted and thanks for using FusionCache!
The design of FusionCache is currently based on the core IMemoryCache
and IDistributedCache
interfaces, so all the features available must also be available (or implementable) with the features available on those interfaces.
Sadly, Clear()
is not available there, therefore it is not possible to build this feature.
ps: I have some plans to explore a different design in the future, after v1.0
will hit the road. That moment will come quite soon, so stay tuned for more 😉
Awesome. Thanks @jodydonetti
Is your feature request related to a problem? Please describe.
Microsoft.Extensions.Caching.Memory
includes aMemoryCache
type commonly used in situations which call forIMemoryCache
. This type features a method,Compact()
:If one were to ever perform a massive arbitrary update, add, or delete action to your database (or other backing store), the cache could become potentially filled with tens, hundreds, or maybe even thousands of stale entries, which could be a problem.
Describe the solution you'd like A method or option to somehow evict arbitrary entries in the cache without knowing their keys, either completely (100% empty) or possibly using similar rules as
MemoryCache#Compact()
, allowing a cache to be partially emptied based on entry age, size, or recent usages. It may also be beneficial to be able to evict all entries of a certain type or types?Describe alternatives you've considered I absolutely could just be unaware of a way to do this already, as I just started using FusionCache a few weeks ago to replace my overengineered caching service in my project.
Additional context N/A