ASP.NET 使用HttpContext.Current.Cache
来源:互联网 发布:wampserver是什么软件 编辑:程序博客网 时间:2024/05/16 13:45
public abstract class BizObject
{
protected const int MAXROWS = int.MaxValue-1;
protected static Cache Cache
{
get { return HttpContext.Current.Cache; }
}
//Cache Data
protected static void CacheData(string key, object data)
{
if (Settings.EnableCaching && data != null)
{
Cache.Insert(key, data, null, DateTime.Now.AddSeconds(Settings.CacheDuration), TimeSpan.Zero);
}
}
/// <summary>
/// 清除带prefix前缀的缓存
/// </summary>
protected static void PurgeCacheItems(string prefix)
{
prefix = prefix.ToLower();
List<string> itemsToRemove = new List<string>();
IDictionaryEnumerator enumerator = BizObject.Cache.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Key.ToString().ToLower().StartsWith(prefix))
itemsToRemove.Add(enumerator.Key.ToString());
}
foreach (string itemToRemove in itemsToRemove)
BizObject.Cache.Remove(itemToRemove);
}
- ASP.NET 使用HttpContext.Current.Cache
- ASP.NET多线程下使用HttpContext.Current为null解决方案
- ASP.NET多线程下使用HttpContext.Current为null解决方案
- HttpRuntime.Cache vs. HttpContext.Current.Cache
- HttpRuntime.Cache vs. HttpContext.Current.Cache
- HttpRuntime.Cache vs. HttpContext.Current.Cache
- HttpContext.Current.Cache vs. HttpRuntime.Cache
- HttpContext.Current.Cache vs. HttpRuntime.Cache
- HttpContext.Current.Cache 和 HttpRuntime.Cache
- HttpContext.Current.Cache vs. HttpRuntime.Cache
- HttpRuntime.Cache vs. HttpContext.Current.Cache
- HttpContext.Current.Cache vs. HttpRuntime.Cache
- HttpContext.Current.Cache vs. HttpRuntime.Cache
- HttpContext.Current.Cache 和 HttpRuntime.Cache
- HttpContext.Current.Cache 和 HttpRuntime.Cache
- ASP.NET System.Web.HttpContext类Current属性 的运用
- 对于asp.net中的服务器变量HttpContext.Current.Request.ServerVariables
- ASP.NET System.Web.HttpContext类Current属性
- 會不會自作多情了...
- 改革春风出满地= =#
- 缓存类设计
- Android 中Intent调用系统程序总结
- 中国人民银行研究生部考研经验谈
- ASP.NET 使用HttpContext.Current.Cache
- java新特性——读写锁ReadWriteLock
- Surround the Trees
- 新特性——读写锁ReadWriteLock (二)
- poj 3259 Wormholes【Bellman-Ford Vs SPFA】
- 多线程 消费者和生产者的问题
- Qt 寻找局域网机器的IP地址
- 令人无法淡定的Qt书----关于数据库模块
- 黑马程序员-生成随机数字