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)); }
/// <summary> /// 存储手机验证码 /// </summary> public void SetPhoneVerificationCode(string key, string value) { string newKey = $"{prePhoneVerificationCodeKey}_{key}"; RedisStoreHelper.SetString(newKey, value, TimeSpan.FromMinutes(1)); }