コード例 #1
0
ファイル: RedisHelper.cs プロジェクト: YC946586/GuildCore
 /// <summary>
 /// 获取Hash中的单个key的值
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="key">Redis Key</param>
 /// <param name="hasFildValue">RedisValue</param>
 /// <returns></returns>
 public static T GetHashKey <T>(string key, string hasFildValue)
 {
     if (!string.IsNullOrWhiteSpace(key) && !string.IsNullOrWhiteSpace(hasFildValue))
     {
         RedisValue value = RedisBase.HashGet(key, hasFildValue);
         if (!value.IsNullOrEmpty)
         {
             return(JsonConvert.DeserializeObject <T>(value));
         }
     }
     return(default(T));
 }
コード例 #2
0
        public MemberLocation Get(Guid teamId, Guid memberId)
        {
            IDatabase db = connection.GetDatabase();

            var            value = (string)db.HashGet(teamId.ToString(), memberId.ToString());
            MemberLocation ml    = MemberLocation.FromJsonString(value);

            return(ml);
        }
コード例 #3
0
 /// <summary>
 /// 在 hash 中获取值
 /// </summary>
 /// <param name="redisKey"></param>
 /// <param name="hashField"></param>
 /// <returns></returns>
 public RedisValue HashGet(string redisKey, string hashField)
 {
     redisKey = GetKeyForRedis(redisKey);
     return(_database.HashGet(redisKey, hashField));
 }