alastairtree / LazyCache

An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
https://nuget.org/packages/LazyCache
MIT License
1.72k stars 159 forks source link

Cache eviction policy when cache is full? #169

Closed Masuzu closed 2 years ago

Masuzu commented 3 years ago

What is the cache eviction policy when the LazyCache is full? Is the behaviour configurable?

alastairtree commented 2 years ago

As we use dotnet MemoryCache this is controlled by that. You can use sizes and eviction policy to control how the cache evicts items and when it is "full". MemoryCache does not respond to memory pressure as a trigger to flush the cache so "fullness" is defined by the developer and not the machine. Some more info at https://docs.microsoft.com/en-us/dotnet/core/extensions/caching