/// <summary> /// 登出 -- 注销当前信息 /// </summary> /// <param name="currentUser"></param> /// <returns></returns> public async Task LogoutAsync(UserCacheBo currentUser) { await RedisClient.DeleteAsync(CacheKeys.USER + currentUser.UserId); await RedisClient.DeleteAsync(CacheKeys.MENU_TREE + currentUser.UserId); LionMemoryCache.Remove(CacheKeys.USER + currentUser.UserId); LionMemoryCache.Remove(CacheKeys.MENU_TREE + currentUser.UserId); }
/// <summary> /// 删除缓存 /// </summary> /// <param name="sid"></param> public static void DeleteCache(string sid = "") { if (string.IsNullOrEmpty(sid)) { sid = GetUidFromClient(); } if (string.IsNullOrEmpty(sid)) { return; } var key = FormatPrefixKey(sid); var redisClient = LionWeb.AutofacContainer.Resolve <RedisClient>(); redisClient.Delete(key); Cache.Remove(key); }