/// <summary> /// 只清理redis的用户 /// </summary> public virtual void EmptyCurrentRedis() { try { UserModel user = Current(); RedisCacheUtils.Select(0); RedisCacheUtils.Remove(GrobalConfig.RedisUserTitle + user.UserId); RedisCacheUtils.Select(1); RedisCacheUtils.Remove(HttpContext.Current.Session.SessionID); } catch (Exception ex) { throw ex; } }
/// <summary> /// 删除登录信息 /// </summary> /// <param name="userId"></param> public virtual void EmptyUser(string userId) { try { string userIdKey = GrobalConfig.RedisUserTitle + userId; RedisCacheUtils.Select(0); string otherSessionId = RedisCacheUtils.Get <string>(userIdKey); RedisCacheUtils.Remove(userIdKey); RedisCacheUtils.Select(1); RedisCacheUtils.Remove(otherSessionId); //todo:clear other session } catch (Exception ex) { throw ex; } }
private void RedisDelClient(string clientSessionId) { RedisCacheUtils.Select(2); RedisCacheUtils.Remove(clientSessionId); }
private void RedisDelTicket(string ticket) { RedisCacheUtils.Select(3); RedisCacheUtils.Remove(ticket); }