示例#1
0
 /// <summary>
 /// 插入Redis数据
 /// </summary>
 /// <param name="hashId"></param>
 /// <param name="data"></param>
 /// <returns></returns>
 public bool InsertRedisData(string hashId, RedisDataEntity data)
 {
     using (var redisClient = RedisManager.GetClient())
     {
         redisClient.SetEntryInHashIfNotExists(hashId, data.Key, data.Name);
     }
     return(true);
 }
示例#2
0
 /// <summary>
 /// 获取Redis数据
 /// </summary>
 /// <param name="hashId"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public RedisDataEntity GetRedisData(string hashId, string key)
 {
     using (var redisClient = RedisManager.GetClient())
     {
         RedisDataEntity data = new RedisDataEntity();
         data.Key  = key;
         data.Name = redisClient.GetValueFromHash(hashId, key);
         return(data);
     }
 }