예제 #1
0
        public void SetUserCached(string sid, UserInfo userInfo, List <UserRoleRelation> userRole)
        {
            string sidKey  = $"{preSidKey}{sid}";
            string userKey = $"{preUserKey}{userInfo.Id}";

            RedisStoreHelper.HashSetString(userKey, "Sid", sid);
            RedisStoreHelper.HashSetValue <UserInfo>(userKey, "UserInfo", userInfo);
            RedisStoreHelper.HashSetValue <List <UserRoleRelation> >(userKey, "UserRole", userRole);
            RedisStoreHelper.KeyExpire(userKey, TimeSpan.FromMinutes(keyExpire));

            RedisStoreHelper.SetString(sidKey, userKey, TimeSpan.FromMinutes(keyExpire));
        }
예제 #2
0
        /// <summary>
        /// 存储手机验证码
        /// </summary>
        public void SetPhoneVerificationCode(string key, string value)
        {
            string newKey = $"{prePhoneVerificationCodeKey}_{key}";

            RedisStoreHelper.SetString(newKey, value, TimeSpan.FromMinutes(1));
        }