示例#1
0
 public void Remove(string key)
 {
     CacheContext.Remove(key);
 }
示例#2
0
 /// <summary>
 /// 根据失效时间获取缓存
 /// </summary>
 /// <param name="key">The key.</param>
 public T GetCache(string key)
 {
     return(CacheContext.Get <T>(key));
 }
示例#3
0
 /// <summary>
 /// 移除一个缓存项
 /// </summary>
 /// <param name="key">缓存项key</param>
 /// <returns>true成功,false失败</returns>
 public bool RemoveCache(string key)
 {
     return(CacheContext.Remove <T>(key));
 }
示例#4
0
 public bool Create(string key, T val, DateTime expire)
 {
     //设置缓存
     return(CacheContext.Set <T>(key, val, expire));
 }
示例#5
0
 /// <summary>
 /// 获取缓存项
 /// </summary>
 /// <typeparam name="T">缓存对象类型</typeparam>
 /// <param name="key">键</param>
 /// <returns>缓存对象</returns>
 public bool CreateCache(string key, T entity, DateTime expire)
 {
     return(CacheContext.Set <T>(key, entity, expire));
 }