好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

asp.net 将设有过期策略的项添加到缓存中

下面的代码示例将有一分钟绝对过期时间的项添加到缓存中:
代码如下:
Cache.Insert("CacheItem6", "Cached Item 6",
null, DateTime.Now.AddMinutes(1d),
System.Web.Caching.Cache.NoSlidingExpiration);

下面的代码示例将有 10 分钟弹性过期时间的项添加到缓存中:
代码如下:
Cache.Insert("CacheItem7", "Cached Item 7",
null, System.Web.Caching.Cache.NoAbsoluteExpiration,
new TimeSpan(0, 10, 0));

查看更多关于asp.net 将设有过期策略的项添加到缓存中的详细内容...

  阅读:48次