Fix caching and loop query on the get current user

This commit is contained in:
2025-10-10 00:57:28 +07:00
parent e4c2f8b7a5
commit e45e140b41
9 changed files with 150 additions and 54 deletions

View File

@@ -149,10 +149,10 @@ public class UserService : IUserService
// Use proper async version to avoid DbContext concurrency issues
user.Accounts = (await _accountService.GetAccountsByUserAsync(user)).ToList();
// Save to cache for 10 minutes if caching is enabled (JWT middleware calls this on every request)
// Save to cache for 5 minutes if caching is enabled (JWT middleware calls this on every request)
if (useCache)
{
_cacheService.SaveValue(cacheKey, user, TimeSpan.FromMinutes(10));
_cacheService.SaveValue(cacheKey, user, TimeSpan.FromMinutes(5));
}
return user;