From 37b16e8395e376af5a49c6edefa691c073b3a576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A9=99=E5=AD=90?= <454313500@qq.com> Date: Thu, 6 Feb 2025 12:54:48 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=95=B4=E4=BD=93=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Repositories/DiscussLableRepository.cs | 12 ++++++++---- Yi.Bbs.Vue3/src/components/InfoCard.vue | 2 +- Yi.Bbs.Vue3/src/components/TreeArticleInfo.vue | 8 +++++--- Yi.Bbs.Vue3/src/layout/AppHeader.vue | 7 +++---- .../src/layout/activity/components/ActivityNav.vue | 4 ++++ Yi.Bbs.Vue3/src/views/Article.vue | 8 ++++---- Yi.Bbs.Vue3/src/views/home/Index.vue | 12 ++++++++---- 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs index 8a2020a8..6793f6c4 100644 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs +++ b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs @@ -1,4 +1,5 @@ using Mapster; +using Microsoft.Extensions.Caching.Distributed; using Volo.Abp.Caching; using Volo.Abp.DependencyInjection; using Yi.Framework.Bbs.Domain.Entities.Forum; @@ -28,10 +29,13 @@ public class DiscussLableRepository : SqlSugarRepository> GetDiscussLableCacheMapAsync() { var cahce = await _lableCache.GetOrAddAsync(DiscussLableConst.DiscussLableCacheKey, async () => - { - var entities = await _DbQueryable.ToListAsync(); - return entities.Adapt>(); - }); + { + var entities = await _DbQueryable.ToListAsync(); + return entities.Adapt>(); + }, () => + new DistributedCacheEntryOptions() + { AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(2) } + ); return cahce.ToDictionary(x => x.Id); } } \ No newline at end of file diff --git a/Yi.Bbs.Vue3/src/components/InfoCard.vue b/Yi.Bbs.Vue3/src/components/InfoCard.vue index ccb24c20..7e8a45c3 100644 --- a/Yi.Bbs.Vue3/src/components/InfoCard.vue +++ b/Yi.Bbs.Vue3/src/components/InfoCard.vue @@ -11,7 +11,7 @@ const onClickText=()=>{