当我的一个商品页面进行了缓存后,
在后台添加了新商品,
但因为前台已经缓存了,
用户刷新看不到.
那怎么去清空这些缓存呢注意:还有另一个要求,因为我的特价商品表没有进行更新
所以这个页面的缓存我不想清空,
而是想清楚商品列表的缓存也就是当我更新某些东西后我想要指定的缓存失效谢谢
在后台添加了新商品,
但因为前台已经缓存了,
用户刷新看不到.
那怎么去清空这些缓存呢注意:还有另一个要求,因为我的特价商品表没有进行更新
所以这个页面的缓存我不想清空,
而是想清楚商品列表的缓存也就是当我更新某些东西后我想要指定的缓存失效谢谢
现在只限VaryByParam和Duration这两个参数
是否还有哪个参数指定关键字
然后再有一个方法像OutputCache.Remove("关键字")??
这样的吗
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UC_List.ascx.cs" Inherits="UserControl_UC_List" %>
<%@ OutputCache Duration="600" VaryByParam="*" %>那我这样生成的了缓存 在程序代码中如何来删除呢 谢谢
Response.AddCacheDependency(new SqlCacheDependency(sqlCommand))其中sqlCommand必须是一个SelectCommand,当它的结果集发生改变时,你的页面cache自动会失效。
Dim CacheEnum As IDictionaryEnumerator = _cache.GetEnumerator()
Dim al As New ArrayList()
While CacheEnum.MoveNext()
al.Add(CacheEnum.Key)
End While For Each key As String In al
_cache.Remove(key)
Next
End Sub
清除页面缓存HttpResponse.RemoveOutputCacheItem("/default.aspx")