Skip to content

Commit

Permalink
Merge pull request #181 from fnoopv/master
Browse files Browse the repository at this point in the history
feat: add SetDeadline method
  • Loading branch information
alexedwards committed Nov 11, 2023
2 parents 84bd122 + b1eea39 commit 944b9c2
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 944b9c2

Please sign in to comment.