예제 #1
0
        public string GetCurrentUserId(HttpContextBase contextBase = null)
        {
            var    key    = LayIMConst.LayIM_Cache_UserLoginToken;
            string token  = CookieHelper.GetCookieValue(key, contextBase);
            var    userid = cacheClient.HashGet <string>(key, token);

            return(userid);
        }
        public bool TryGetValue(string key, out TValue value)
        {
            if (IsKeyNull(key))
            {
                throw KeyNullException;
            }

            //			value = default(TValue);
            //          var redisValue = CacheClient.HashGet(redisKey, key.ToRedisValue());
            //          if (redisValue.IsNullOrEmpty)
            //          {
            //              return false;
            //          }
            //value = redisValue.To<TValue>();
            value = CacheClient.HashGet <TValue>(redisKey, key.ToRedisValue());
            if (value == null)
            {
                return(false);
            }
            return(true);
        }
 public T HashGet<T>(string hashKey, string key)
 {
     return ExecuteWithRetry(() => cacheClient.HashGet<T>(hashKey, key));
 }