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 string GetSidByUserId(string userId) { string userKey = $"{preUserKey}{userId}"; if (RedisStoreHelper.KeyExists(userKey)) { return(RedisStoreHelper.HashGetString(userKey, "Sid")); } return(null); }
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); }
public bool SidExists(string sid) { string sidKey = $"{preSidKey}{sid}"; return(RedisStoreHelper.KeyExists(sidKey)); }