💄 Optimzation

This commit is contained in:
2025-10-26 00:25:38 +08:00
parent 609b130b4e
commit 3af4069581
2 changed files with 23 additions and 11 deletions

View File

@@ -51,11 +51,11 @@ public class ThoughtService(AppDatabase db, ICacheService cache)
var thoughts = await db.ThinkingThoughts
.Where(t => t.SequenceId == sequence.Id)
.OrderBy(t => t.CreatedAt)
.OrderByDescending(t => t.CreatedAt)
.ToListAsync();
// Cache for 10 minutes
await cache.SetWithGroupsAsync(cacheKey, thoughts, new[] { $"sequence:{sequence.Id}" }, TimeSpan.FromMinutes(10));
await cache.SetWithGroupsAsync(cacheKey, thoughts, [$"sequence:{sequence.Id}"], TimeSpan.FromMinutes(10));
return thoughts;
}