Fix perf with cache
This commit is contained in:
@@ -144,12 +144,8 @@ public class UserService : IUserService
|
||||
|
||||
// Fetch from database (either cache miss or cache disabled)
|
||||
var account = await _accountService.GetAccountByKey(address, true, false);
|
||||
var user = await _userRepository.GetUserByNameAsync(account.User.Name);
|
||||
var user = await _userRepository.GetUserByNameAsync(account.User.Name, true);
|
||||
|
||||
// Use proper async version to avoid DbContext concurrency issues
|
||||
user.Accounts = (await _accountService.GetAccountsByUserAsync(user)).ToList();
|
||||
|
||||
// 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(5));
|
||||
|
||||
Reference in New Issue
Block a user