ASP.NET Cached Items Being Removed

Lately some of the items I've been placing in cache in ASP.NET have been being removed. When I assigned a callback method to trap these removals, I saw that the reason for removal was "underused" -- ASP.NET was removing these items to free up memory because they weren't being used often.

To prevent this from happening, use the following value for the priority parameter of Cache.Add():
CacheItemPriority.NotRemovable

Comments

Popular posts from this blog

A Generic Method Using HttpClient to Make a Synchronous Get Request

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception

"$.ajax is not a function" Error When Using jQuery and Darren Johnstone's ASP.NET Upload/Download Module v2