From 0f36152127ba9a6ba2eaa9079b78b33d31b96177 Mon Sep 17 00:00:00 2001 From: Gabriel MABILLE Date: Thu, 11 Nov 2021 16:25:57 +0100 Subject: [PATCH] UserCacheService: Use value instead of pointer (#41549) --- pkg/services/sqlstore/user.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/services/sqlstore/user.go b/pkg/services/sqlstore/user.go index 1015811ce85..0cc36a5746c 100644 --- a/pkg/services/sqlstore/user.go +++ b/pkg/services/sqlstore/user.go @@ -522,7 +522,8 @@ func newSignedInUserCacheKey(orgID, userID int64) string { func (ss *SQLStore) GetSignedInUserWithCacheCtx(ctx context.Context, query *models.GetSignedInUserQuery) error { cacheKey := newSignedInUserCacheKey(query.OrgId, query.UserId) if cached, found := ss.CacheService.Get(cacheKey); found { - query.Result = cached.(*models.SignedInUser) + cachedUser := cached.(models.SignedInUser) + query.Result = &cachedUser return nil } @@ -532,7 +533,7 @@ func (ss *SQLStore) GetSignedInUserWithCacheCtx(ctx context.Context, query *mode } cacheKey = newSignedInUserCacheKey(query.Result.OrgId, query.UserId) - ss.CacheService.Set(cacheKey, query.Result, time.Second*5) + ss.CacheService.Set(cacheKey, *query.Result, time.Second*5) return nil }