MCPcopy Create free account
hub / github.com/apache/answer / GetUserCacheInfo

Method GetUserCacheInfo

internal/repo/auth/auth.go:49–60  ·  view source on GitHub ↗

GetUserCacheInfo get user cache info

(ctx context.Context, accessToken string)

Source from the content-addressed store, hash-verified

47
48// GetUserCacheInfo get user cache info
49func (ar *authRepo) GetUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error) {
50 userInfoCache, exist, err := ar.data.Cache.GetString(ctx, constant.UserTokenCacheKey+accessToken)
51 if err != nil {
52 return nil, errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
53 }
54 if !exist {
55 return nil, nil
56 }
57 userInfo = &entity.UserCacheInfo{}
58 _ = json.Unmarshal([]byte(userInfoCache), userInfo)
59 return userInfo, nil
60}
61
62// SetUserCacheInfo set user cache info
63func (ar *authRepo) SetUserCacheInfo(ctx context.Context,

Callers

nothing calls this directly

Calls 1

GetStringMethod · 0.80

Tested by

no test coverage detected