Adjust Redis data expiration time

This commit is contained in:
2024-09-08 20:07:04 +07:00
parent 2f34be41e5
commit b46915e46d
2 changed files with 3 additions and 3 deletions

View File

@ -39,7 +39,7 @@ func (r *Service) GetUser(ctx context.Context, email string) (*models.User, erro
} }
newUserJSON, _ := json.Marshal(user) newUserJSON, _ := json.Marshal(user)
err = r.cache.SetCache(ctx, email, newUserJSON, time.Hour*24) err = r.cache.SetCache(ctx, "UserCache:"+email, newUserJSON, time.Hour*12)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -54,7 +54,7 @@ func Create(values types.User) (*Session, error) {
return nil, err return nil, err
} }
err = app.Server.Cache.SetCache(context.Background(), "Session:"+id, string(sessionData), time.Hour*24) err = app.Server.Cache.SetCache(context.Background(), "Session:"+id, string(sessionData), time.Hour*24*7)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -106,7 +106,7 @@ func AddSessionInfo(email string, sessionInfo *SessionInfo) error {
return err return err
} }
err = app.Server.Cache.SetCache(context.Background(), "UserSessionInfo:"+email+":"+sessionInfo.SessionID, string(sessionInfoData), 0) err = app.Server.Cache.SetCache(context.Background(), "UserSessionInfo:"+email+":"+sessionInfo.SessionID, string(sessionInfoData), time.Hour*24*7)
if err != nil { if err != nil {
return err return err
} }