How many types of Cache is there in asp.net
How many types of cache is there in asp.net and how can implement 开发者_运维知识库it ?
There is 1 Cache object, that you can use more or less like the Application object
And there is Output caching, per page or per user control.
You would use the Cache object like this (there are overloads):
Cache.Insert("myKey", myValue, null, DateTime.Now.AddMinutes(2),
System.Web.Caching.Cache.NoSlidingExpiration);
And for outputcaching, you can use this line below the <%@ Page %>
line:
<%@ OutputCache Duration="120" VaryByParam="myParam"%>
You can use the CacheManager http://msdn.microsoft.com/en-us/library/cc467894.aspx from the Enterprise Library or if you want a distributed cache you can go for Memcached http://memcached.org/
精彩评论