开发者

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜