Reputation: 1806
I decided to store my data for example List of country, state, city, book and other data in cache for speed of my web site but I found that when the cache item count is 10 and Cache.EffectivePercentagePhysicalMemoryLimit is 98 I add my data to cache but other data will remove.
I set cache expiration to 20 min.how should I set size of cache? how should I do with this problem? why data I stored in cache has been removed in asp.net
in below code I have set a breakpoint the method return an empty list and when I check other data like country and state they have been removed from cache
var cahpters= CacheData.Data.Chapter.list(bookid.ToString());
Upvotes: 1
Views: 297
Reputation: 16983
why data i stored in cache has been removed in asp.net
Objects can be explicitly taken out of the cache when:
Remove
Most probably in your case you have huge memory consumption so ASP.NET decided to save memory by removing you item from the cache.
Also you can register for removal notification (including the reason). See more about that here: https://msdn.microsoft.com/en-us/library/7kxdx246%28v=vs.140%29.aspx
Upvotes: 1