1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

publish v12.2.0-alpha6

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-02-18 22:19:33 +02:00
parent 4899fe95f4
commit 41026c9209
21 changed files with 984 additions and 284 deletions

View File

@@ -4,6 +4,8 @@ import (
"errors"
"sync"
"time"
"github.com/kataras/iris/v12/context"
)
type (
@@ -13,6 +15,7 @@ type (
mu sync.RWMutex
sessions map[string]*Session
db Database
dbRequestHandler DatabaseRequestHandler
destroyListeners []DestroyListener
}
)
@@ -35,6 +38,9 @@ func (p *provider) RegisterDatabase(db Database) {
p.mu.Lock() // for any case
p.db = db
if dbreq, ok := db.(DatabaseRequestHandler); ok {
p.dbRequestHandler = dbreq
}
p.mu.Unlock()
}
@@ -84,6 +90,12 @@ func (p *provider) Init(man *Sessions, sid string, expires time.Duration) *Sessi
return newSession
}
func (p *provider) EndRequest(ctx *context.Context, session *Session) {
if p.dbRequestHandler != nil {
p.dbRequestHandler.EndRequest(ctx, session)
}
}
// ErrNotFound may be returned from `UpdateExpiration` of a non-existing or
// invalid session entry from memory storage or databases.
// Usage: