Esempio n. 1
0
 /// <summary>
 /// 将数据替换掉
 /// </summary>
 /// <param name="internalConfiguration"></param>
 /// <returns></returns>
 public Response AddOrReplace(IInternalConfiguration internalConfiguration)
 {
     lock (LockObject)
     {
         //存储基本的配置
         redis.RedisString().Add(RedisCacheKey, internalConfiguration);
     }
     return(new OkResponse());
 }
Esempio n. 2
0
 /// <summary>
 /// 添加key
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="ttl"></param>
 /// <param name="region"></param>
 public void Add(string key, T value, TimeSpan ttl, string region)
 {
     //验证时间是否正确
     if (ttl.TotalMilliseconds <= 0)
     {
         return;
     }
     //保存数据
     redis.RedisString().Add <T>(prefix + key, value, ttl);
 }
Esempio n. 3
0
 public async Task RedisTest()
 {
     await redis.RedisString().AddAsync("1", new Random().Next(1000, 9999).ToString());
 }