mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 11:57:02 +00:00
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/kataras/iris/v12/context"
|
||||
"github.com/kataras/iris/v12/core/host"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -51,6 +52,9 @@ func New(cfg Config) *Sessions {
|
||||
// a session db doesn't have write access
|
||||
func (s *Sessions) UseDatabase(db Database) {
|
||||
db.SetLogger(s.config.Logger) // inject the logger.
|
||||
host.RegisterOnInterrupt(func() {
|
||||
db.Close()
|
||||
})
|
||||
s.provider.RegisterDatabase(db)
|
||||
}
|
||||
|
||||
@@ -125,8 +129,6 @@ func (s *Sessions) Start(ctx *context.Context, cookieOptions ...context.CookieOp
|
||||
// fmt.Printf("%s=%s\n", key, value)
|
||||
// })
|
||||
// }
|
||||
sess.isNew = s.provider.db.Len(sid) == 0
|
||||
|
||||
s.updateCookie(ctx, sid, s.config.Expires, cookieOptions...)
|
||||
|
||||
return sess
|
||||
|
||||
Reference in New Issue
Block a user