Reputation: 29
I have a legacy application, rather large that implements both System.Web.Caching and System.Runtime.Caching. Yes that's right, there are services running in the same application pool that could be using either.
My question is how will these interact as far as memory limits are concerned ? From what I have read the default limit for MemoryCache is 60% of available memory which is great. I suppose the question more directly is then does the System.Web.Caching instance share that same 60% ?
I also have a named instance of MemoryCache limited to 100mb.
What I want to understand is what happens to my MemoryCache instance if or when System.Web.Caching gets filled and ejections are forced ?
Upvotes: 2
Views: 205
Reputation: 19350
When cache reaches its limits it start to evict its oldest items or items with closest expiration times, depends on policy. You can set amount of memory for your Web Cache. Check this post, it explains all of this . All caches work in a similar way. Also, look into NCache. They have free version. It allows to do so much more with cache especially for Web Farms.
so, you asked: how will these interact as far as memory limits are concerned? - They will not interact. They will do what they do for each one separately. Each will have limited resources. Try to use one cache, instead of multiple, you will save resources for actually caching items.
Upvotes: 1