自定义缓存

public class CacheHelper
{
///


/// 获取缓存中的数据
///

///
///
public static object Get(string key)
{
System.Web.Caching.Cache cache = HttpRuntime.Cache;
return cache[key];
}
///
/// 添加
///

///
///
public static void Set(string key,object value)
{
System.Web.Caching.Cache cache = HttpRuntime.Cache;
cache[key] = value;
}
///
/// 移除
///

///
public static void Remove(string key)
{
System.Web.Caching.Cache cache = HttpRuntime.Cache;
cache.Remove(key);
}
}

posted on 2015-04-11 19:16  木屐  阅读(122)  评论(0编辑  收藏  举报

导航