chore: update store cache

This commit is contained in:
Steven
2024-05-12 13:19:31 +08:00
parent 93e8fa4912
commit cf423026a5
6 changed files with 19 additions and 8 deletions

View File

@@ -65,7 +65,10 @@ func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]
func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error) {
if find.UserID != nil {
if cache, ok := s.userSettingCache.Load(getUserSettingCacheKey(*find.UserID, find.Key.String())); ok {
return cache.(*storepb.UserSetting), nil
userSetting, ok := cache.(*storepb.UserSetting)
if ok {
return userSetting, nil
}
}
}