缓存依赖关联文本文件
HashSet<string> uset = new HashSet<string>();
//添加缓存依赖
System.Web.Caching.CacheDependency cdy = new System.Web.Caching.CacheDependency(baseUrl + @"Config\BlackList.txt");
//添加缓存项
HttpRuntime.Cache.Insert(
"BlackList",
uset,
cdy,
DateTime.MaxValue,
System.Web.Caching.Cache.NoSlidingExpiration
);
本文介绍了一种使用HashSet和CacheDependency在.NET中实现缓存依赖的方法,通过实例展示了如何将文本文件作为缓存依赖项,确保缓存数据与源文件同步更新。
771

被折叠的 条评论
为什么被折叠?



