예제 #1
0
 /// <summary>
 /// 移除全部缓存
 /// </summary>
 public void RemoveAllCache()
 {
     RedisCacheManager.RemoveAll();
 }
예제 #2
0
 /// <summary>
 /// 移除指定数据缓存
 /// </summary>
 /// <param name="cacheKey">键</param>
 public void RemoveCache(string cacheKey)
 {
     RedisCacheManager.Remove(cacheKey);
 }
예제 #3
0
 /// <summary>
 /// 写入缓存
 /// </summary>
 /// <param name="value">对象数据</param>
 /// <param name="cacheKey">键</param>
 /// <param name="expireTime">到期时间</param>
 public void WriteCache <T>(string cacheKey, T value, DateTime expireTime) where T : class
 {
     RedisCacheManager.Set(cacheKey, value, expireTime);
 }
예제 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="value"></param>
 /// <param name="cacheKey"></param>
 /// <param name="slidingExpiration"></param>
 public void WriteCache <T>(string cacheKey, T value, TimeSpan slidingExpiration) where T : class
 {
     RedisCacheManager.Set(cacheKey, value, slidingExpiration);
 }
예제 #5
0
 /// <summary>
 /// 读取缓存
 /// </summary>
 /// <param name="cacheKey">键</param>
 /// <returns></returns>
 public T GetCache <T>(string cacheKey) where T : class
 {
     return(RedisCacheManager.Get <T>(cacheKey));
 }