搬砖的小木匠

关注

清除 System.Web.Caching.Cache 以

搬砖的小木匠

关注

阅读 40

2022-07-12

 

public static void ClearStartCache(string keyStart)
{
List<string> cacheKeys = new List<string>();
System.Web.Caching.Cache _cache = HttpRuntime.Cache;
var cacheEnum=_cache.GetEnumerator();
while (cacheEnum.MoveNext())
{
string keyStr = cacheEnum.Key.ToString();
if (keyStr.StartsWith(keyStart))
{
cacheKeys.Add(keyStr);
}
}
foreach (string cacheKey in cacheKeys)
{
_cache.Remove(cacheKey);
}
}

 



相关推荐

alonwang

System.Web.Caching.Cache删除某键后,希望同时触发其它动作(关键时刻,还是事件靠的住)

alonwang 23 0 0

小_北_爸

PHP Caching / Cache || FILTERS

小_北_爸 53 0 0

鱼满舱

FS-Cache: Netfs 'nfs' registered for caching

鱼满舱 117 0 0

慕容冲_a4b8

利用System.Web.HttpRuntime.Cache制作缓存工具类

慕容冲_a4b8 6 0 0

白衣蓝剑冰魄

YII2.0框架(三) 缓存机制yii\caching\Cache

白衣蓝剑冰魄 140 0 0

四月Ren间

Centos7设置定时清除buff/cache的脚本

四月Ren间 86 0 0

飞鸟不急

System.Net.Mail和System.Web.Mail

飞鸟不急 92 0 0

小时候是个乖乖

ganglia Web前段清除当机节点

小时候是个乖乖 77 0 0

快乐小鱼儿_9911

PHP Web System Optimization(undone)

快乐小鱼儿_9911 172 0 0

辰鑫chenxin

Squid cache Web静态缓存框架

辰鑫chenxin 45 0 0

精彩评论(0)

0 0 举报