mirror of
https://github.com/alexedwards/scs.git
synced 2025-07-17 01:12:21 +02:00
Add LoadNew method
This commit is contained in:
9
data.go
9
data.go
@ -83,6 +83,15 @@ func (s *SessionManager) Load(ctx context.Context, token string) (context.Contex
|
|||||||
return s.addSessionDataToContext(ctx, sd), nil
|
return s.addSessionDataToContext(ctx, sd), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LoadNew returns a new context.Context containing a new empty instance of
|
||||||
|
// session data.
|
||||||
|
//
|
||||||
|
// Most applications will use the LoadAndSave() middleware and will not need to
|
||||||
|
// use this method.
|
||||||
|
func (s *SessionManager) LoadNew(ctx context.Context) (context.Context, error) {
|
||||||
|
return s.addSessionDataToContext(ctx, newSessionData(s.Lifetime)), nil
|
||||||
|
}
|
||||||
|
|
||||||
// Commit saves the session data to the session store and returns the session
|
// Commit saves the session data to the session store and returns the session
|
||||||
// token and expiry time.
|
// token and expiry time.
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user