public void UpdateExpire(string sid) { string sidKey = $"{preSidKey}{sid}"; if (RedisStoreHelper.KeyExists(sidKey)) { string userKey = RedisStoreHelper.GetString(sidKey); RedisStoreHelper.KeyExpire(userKey, TimeSpan.FromMinutes(keyExpire)); RedisStoreHelper.KeyExpire(sidKey, TimeSpan.FromMinutes(keyExpire)); } }
public async Task <UserInfo> GetUserInfoFromCached(string sid) { string sidKey = $"{preSidKey}{sid}"; if (RedisStoreHelper.KeyExists(sidKey)) { string userKey = RedisStoreHelper.GetString(sidKey); return(await RedisStoreHelper.HashGetValueAsync <UserInfo>(userKey, "UserInfo")); } return(null); }
public void RemoveUserCached(string sid) { string sidKey = $"{preSidKey}{sid}"; if (RedisStoreHelper.KeyExists(sidKey)) { string userKey = RedisStoreHelper.GetString(sidKey); RedisStoreHelper.KeyDelete(userKey); RedisStoreHelper.KeyDelete(sidKey); } }
public List <UserRoleRelation> GetUserRoleBySid(string sid) { string sidKey = $"{preSidKey}{sid}"; if (RedisStoreHelper.KeyExists(sidKey)) { string userKey = RedisStoreHelper.GetString(sidKey); return(RedisStoreHelper.HashGetValue <List <UserRoleRelation> >(userKey, "UserRole")); } return(null); }
/// <summary> /// 获取手机验证码 /// </summary> public string GetPhoneVerificationCode(string key) { string newKey = $"{prePhoneVerificationCodeKey}_{key}"; return(RedisStoreHelper.GetString(newKey)); }