mirror of
https://github.com/kataras/iris.git
synced 2026-01-09 13:05:56 +00:00
Little change of session API + Update examples
Former-commit-id: e8c58b186acf1c8932af6e886dae7035f4d581c1
This commit is contained in:
@@ -119,14 +119,19 @@ func (s *Sessions) Start(ctx context.Context) *Session {
|
||||
}
|
||||
|
||||
// ShiftExpiraton move the expire date of a session to a new date by using session default timeout configuration
|
||||
func (s *Sessions) ShiftExpiraton(ctx context.Context, sid string) {
|
||||
s.UpdateExpiraton(ctx, sid, s.config.Expires)
|
||||
func (s *Sessions) ShiftExpiraton(ctx context.Context) {
|
||||
s.UpdateExpiraton(ctx, s.config.Expires)
|
||||
}
|
||||
|
||||
// UpdateExpiraton change expire date of a session to a new date by using timeout value passed by `expires` parameter
|
||||
func (s *Sessions) UpdateExpiraton(ctx context.Context, sid string, expires time.Duration) {
|
||||
if s.provider.UpdateExpiraton(sid, expires) {
|
||||
s.updateCookie(sid, ctx, expires)
|
||||
func (s *Sessions) UpdateExpiraton(ctx context.Context, expires time.Duration) {
|
||||
cookieValue := GetCookie(ctx, s.config.Cookie)
|
||||
|
||||
if cookieValue != "" {
|
||||
sid := s.decodeCookieValue(cookieValue)
|
||||
if s.provider.UpdateExpiraton(sid, expires) {
|
||||
s.updateCookie(sid, ctx, expires)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user