public class CacheHelper<T>
{
CacheManager cache = CacheFactory.GetCacheManager();
/// <summary>
/// 从缓存中取数据
/// </summary>
/// <param name="keyword"></param>
/// <returns></returns>
public T GetCache(string keyword)
{
return (T)cache.GetData(keyword);
}
/// <summary>
/// 加入缓存
/// </summary>
/// <param name="keyword"></param>
/// <param name="cachedata"></param>
public void PushCache(string keyword, T cachedata)
{
cache.Add(keyword, cachedata);
}
/// <summary>
/// 从缓存中移除一项
/// </summary>
/// <param name="keyword"></param>
public void RemoveCache(string keyword)
{
cache.Remove(keyword);
}
/// <summary>
/// 清除缓存
/// </summary>
public void FlushCache()
{
cache.Flush();
}
}