Skip to content

Commit

Permalink
Add default ttl for users in cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduard Keilholz committed Feb 19, 2024
1 parent 52552a8 commit 8214486
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Wam.Users/Services/UsersService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class UsersService(

private const string StateStoreName = "statestore";

private static Dictionary<string, string> defaultCacheMetaData = new()
private readonly Dictionary<string, string> defaultCacheMetaData = new()
{
{
"ttlInSeconds", "900"
Expand Down Expand Up @@ -62,7 +62,9 @@ private async Task<UserDetailsDto> GetFromStateStoreOrRepository(Guid userId, Ca
}

var userDetailsFromRepository = await GetUserDetailsFromRepository(userId, cancellationToken);
await daprClient.SaveStateAsync(StateStoreName, CacheName.UserDetails(userId), userDetailsFromRepository,
await daprClient.SaveStateAsync(StateStoreName,
CacheName.UserDetails(userId), userDetailsFromRepository,
metadata: defaultCacheMetaData,
cancellationToken: cancellationToken);
return userDetailsFromRepository;
}
Expand Down

0 comments on commit 8214486

Please # to comment.