/// <summary>
/// 获取数据缓存
/// </summary>
/// <param name="CacheKey">键</param>
public static object GetCache(string CacheKey)
{
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
return objCache[CacheKey];
}
/// <summary>
/// 设置数据缓存
/// </summary>
public static void SetCache(string CacheKey, object objObject)
{
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
objCache.Insert(CacheKey, objObject);
}
/// <summary>
/// 设置数据缓存
/// </summary>
public static void SetCache(string CacheKey, object objObject, TimeSpan Timeout)
{
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
objCache.Insert(CacheKey, objObject, null, DateTime.MaxValue, Timeout, System.Web.Caching.CacheItemPriority.NotRemovable, null);
}
/// <summary>
/// 设置数据缓存
/// </summary>
public static void SetCache(string CacheKey, object objObject, DateTime absoluteExpiration, TimeSpan slidingExpiration)
{
System.Web.Caching.Cache objCache = HttpRuntime.Cache;
objCache.Insert(CacheKey, objObject, null, absoluteExpiration, slidingExpiration);
}
/// <summary>
/// 移除指定数据缓存
/// </summary>
public static void RemoveAllCache(string CacheKey)
{
System.Web.Caching.Cache _cache = HttpRuntime.Cache;
_cache.Remove(CacheKey);
}
/// <summary>
/// 移除全部缓存
/// </summary>
public static void RemoveAllCache()
{
System.Web.Caching.Cache _cache = HttpRuntime.Cache;
IDictionaryEnumerator CacheEnum = _cache.GetEnumerator();
while (CacheEnum.MoveNext())
{
_cache.Remove(CacheEnum.Key.ToString());
}
}

最新文章

  1. MVC 下 JsonResult 的使用方法(JsonRequestBehavior.AllowGet)【转】
  2. 自定义Java集合
  3. Android属性之build.prop生成过程分析
  4. jquery 展开折叠效果
  5. Linux之samba搭建
  6. RichTextBox 自动滚动到最后
  7. UVa 12304 (6个二维几何问题合集) 2D Geometry 110 in 1!
  8. 解决eclipse复制粘贴js代码卡死的问题
  9. Hubot Slack CoffeeScript
  10. NSRunLoop个人理解
  11. Objective-C 链式编程思想
  12. Redis6-sorted set 的介绍
  13. UVALive 2517 Moving Object Recognition(模拟)
  14. Base-64编码介绍
  15. null和undefined的异同
  16. css选择器概述
  17. Saving custom fields in production order
  18. [CF1038D]Slime
  19. FJUT3701 这也是一道数论题(线段树)题解
  20. 超轻量级Json框架SmartObject

热门文章

  1. git clone,push,pull,fetch命令详解
  2. 使用Git【转】
  3. Signing package index... Cannot open file &#39;/home/jello/openwrt/key-build&#39; for reading
  4. codeforces 300 div2 B.Pasha and Phone 容斥原理
  5. 个人知识管理系统Version1.0开发记录(05)
  6. IOS-网络(文件压缩和解压缩)
  7. google搜索 site:pku.edu.cn inurl:aspx 即可查找所有动态网页 =====html(静态网页) asp(动态) jsp(动态) php(动态) cgi(网络程序) aspx(动态)
  8. word问题禁止宏
  9. easyui panel自适应浏览器宽度
  10. PHP7.2.12-Configuration-Option