update session info

This commit is contained in:
Gregory Wells
2026-06-07 20:36:23 -04:00
parent 4256e5ba8a
commit f8b37d9836
+17
View File
@@ -85,7 +85,24 @@ func (m *RedisStore) Get(sessionID string) (*SessionData, error) {
}
return &session_data, nil
}
func (m *RedisStore) Update(sessionID string, session *SessionData) error {
hashedSession := hashSession(sessionID)
data, err := json.Marshal(*session)
if err != nil {
return ErrSessionBackend
}
updated, err := m.client.SetXX(m.ctx, hashedSession, data, 0).Result()
if err != nil {
logging.Error(err.Error())
return ErrSessionBackend
}
if !updated {
return ErrSessionNotFound
}
return nil
}