public void Remove(string key) { CacheContext.Remove(key); }
/// <summary> /// 根据失效时间获取缓存 /// </summary> /// <param name="key">The key.</param> public T GetCache(string key) { return(CacheContext.Get <T>(key)); }
/// <summary> /// 移除一个缓存项 /// </summary> /// <param name="key">缓存项key</param> /// <returns>true成功,false失败</returns> public bool RemoveCache(string key) { return(CacheContext.Remove <T>(key)); }
public bool Create(string key, T val, DateTime expire) { //设置缓存 return(CacheContext.Set <T>(key, val, expire)); }
/// <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)); }