From 2bbef9b9d1790c96dda7f4c90652e3a7cf628dd5 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 5 Aug 2025 22:55:26 +0800 Subject: [PATCH] :bug: Remove the cache in poll --- DysonNetwork.Sphere/Poll/PollService.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/DysonNetwork.Sphere/Poll/PollService.cs b/DysonNetwork.Sphere/Poll/PollService.cs index 3cf2467..c6fd649 100644 --- a/DysonNetwork.Sphere/Poll/PollService.cs +++ b/DysonNetwork.Sphere/Poll/PollService.cs @@ -31,26 +31,12 @@ public class PollService(AppDatabase db, ICacheService cache) } } - private const string PollCachePrefix = "poll:"; - public async Task GetPoll(Guid id) { - var cacheKey = $"{PollCachePrefix}{id}"; - var cachedPoll = await cache.GetAsync(cacheKey); - if (cachedPoll is not null) - return cachedPoll; - var poll = await db.Polls .Where(e => e.Id == id) .Include(e => e.Questions) - .AsNoTracking() .FirstOrDefaultAsync(); - - if (poll is null) return null; - - poll.Publisher = null; - await cache.SetAsync(cacheKey, poll, TimeSpan.FromMinutes(30)); - return poll; }