企业库缓存类(EnterpriseLibrary CacheHelper )

     
     
   
   
public class CacheHelper < T >
{
CacheManager cache
= CacheFactory.GetCacheManager();
///
/// 从缓存中取数据
///

///
///
public T GetCache( string keyword)
{
return (T)cache.GetData(keyword);
}
///
/// 加入缓存
///

///
///
public void PushCache( string keyword, T cachedata)
{
cache.Add(keyword, cachedata);
}
///
/// 从缓存中移除一项
///

///
public void RemoveCache( string keyword)
{
cache.Remove(keyword);
}
///
/// 清除缓存
///

public void FlushCache()
{
cache.Flush();
}

}

 

你可能感兴趣的:(企业库缓存类(EnterpriseLibrary CacheHelper ))