Does System.Web.Caching use the LRU algorithm?

I was just working on the documentation for an open source project that I created some time ago called WebCacheHelper . This is an abstraction on top of the existing Cache functionality in System.Web.Caching.

I am having trouble finding the details of the algorithm used to clear the cache when the server is running low on memory.

I found this text on MSDN :

When the web server hosting the ASP.NET application runs low on memory, the Cache object selectively flushes items to free system memory . when an item is added to the cache, you can give it a relative priority over other items stored in the cache. Elements to which you assign higher priority values ​​are less likely to be removed from the cache when the server processes a large number of requests, while elements to which you assign lower priority values ​​are more likely to be deleted.

It's still a bit vague to my taste. I want to know what other factors are used to determine when to clear a cached object. Is this a combination of the last available time and priority?

+4
source share
1 answer

. TrimIfNecessary() CacheSingle. -, FlushExpiredItems() CacheExpires. , "" CacheUsage.FlushUnderUsedItems(). / "" CacheItemPriority, /LRU . . ( 10 ). - . CacheItemPriority.Low LRU. , , LRU . CacheItemPriority.NotRemovable, .

+2

Source: https://habr.com/ru/post/1543263/


All Articles