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

Method GetAdminUserCacheInfo

internal/repo/auth/auth.go:156–168  ·  view source on GitHub ↗

GetAdminUserCacheInfo get admin user cache info

(ctx context.Context, accessToken string)

Source from the content-addressed store, hash-verified

154
155// GetAdminUserCacheInfo get admin user cache info
156func (ar *authRepo) GetAdminUserCacheInfo(ctx context.Context, accessToken string) (userInfo *entity.UserCacheInfo, err error) {
157 userInfoCache, exist, err := ar.data.Cache.GetString(ctx, constant.AdminTokenCacheKey+accessToken)
158 if err != nil {
159 err = errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()
160 return
161 }
162 if !exist {
163 return nil, nil
164 }
165 userInfo = &entity.UserCacheInfo{}
166 _ = json.Unmarshal([]byte(userInfoCache), userInfo)
167 return userInfo, nil
168}
169
170// SetAdminUserCacheInfo set admin user cache info
171func (ar *authRepo) SetAdminUserCacheInfo(ctx context.Context, accessToken string, userInfo *entity.UserCacheInfo) (err error) {

Callers

nothing calls this directly

Calls 1

GetStringMethod · 0.80

Tested by

no test coverage detected