System.Runtime.Caching.MemoryCache vs HttpRuntime.Cache - are there any differences?

前端 未结 4 1783
执念已碎
执念已碎 2020-12-07 14:24

I\'m wondering if there are any differences between MemoryCache and HttpRuntime.Cache, which one is preferred in ASP.NET MVC projects?

As f

4条回答
  •  甜味超标
    2020-12-07 14:36

    MemoryCache is what it says it is, a cache stored in memory

    HttpRuntime.Cache (see http://msdn.microsoft.com/en-us/library/system.web.httpruntime.cache(v=vs.100).aspx and http://msdn.microsoft.com/en-us/library/system.web.caching.cache.aspx) persists to whatever you configure it to in your application.

    see for example "ASP.NET 4.0: Writing custom output cache providers" http://weblogs.asp.net/gunnarpeipman/archive/2009/11/19/asp-net-4-0-writing-custom-output-cache-providers.aspx

提交回复
热议问题