Skip to content

Commit

Permalink
feat: add SetDeadline method
Browse files Browse the repository at this point in the history
  • Loading branch information
fnoopv committed Oct 23, 2023
1 parent 84bd122 commit b1eea39
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions data.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,19 @@ func (s *SessionManager) Deadline(ctx context.Context) time.Time {
return sd.deadline
}

// SetDeadline updates the 'absolute' expiry time for the session. Please note
// that if you are using an idle timeout, it is possible that a session will
// expire due to non-use before the set deadline.
func (s *SessionManager) SetDeadline(ctx context.Context, expire time.Time) {
sd := s.getSessionDataFromContext(ctx)

sd.mu.Lock()
defer sd.mu.Unlock()

sd.deadline = expire
sd.status = Modified
}

// Token returns the session token. Please note that this will return the
// empty string "" if it is called before the session has been committed to
// the store.
Expand Down

0 comments on commit b1eea39

Please sign in to comment.