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