mirror of
https://github.com/kataras/iris.git
synced 2026-01-06 11:37:06 +00:00
🌈 sessions were re-written, update to 4.0.0-alpha.2, read HISTORY.md
**Sessions were re-written ** - Developers can use more than one 'session database', at the same time, to store the sessions - Easy to develop a custom session database (only two functions are required (Load & Update)), [learn more](https://github.com/iris-contrib/sessiondb/blob/master/redis/database.go) - Session databases are located [here](https://github.com/iris-contrib/sessiondb), contributions are welcome - The only frontend deleted 'thing' is the: **config.Sessions.Provider** - No need to register a database, the sessions works out-of-the-box - No frontend/API changes except the `context.Session().Set/Delete/Clear`, they doesn't return errors anymore, btw they (errors) were always nil :) - Examples (master branch) were updated. ```sh $ go get github.com/iris-contrib/sessiondb/$DATABASE ``` ```go db := $DATABASE.New(configurationHere{}) iris.UseSessionDB(db) ``` > Note: Book is not updated yet, examples are up-to-date as always.
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
package sessions
|
||||
|
||||
import "github.com/kataras/iris/config"
|
||||
|
||||
// New creates & returns a new Manager and start its GC
|
||||
func New(cfg ...config.Sessions) *Manager {
|
||||
c := config.DefaultSessions().Merge(cfg)
|
||||
// If provider is empty then return nil manager, means that the sessions are disabled
|
||||
if c.Provider == "" {
|
||||
return nil
|
||||
}
|
||||
manager, err := newManager(c)
|
||||
if err != nil {
|
||||
panic(err.Error()) // we have to panic here because we will start GC after and if provider is nil then many panics will come
|
||||
}
|
||||
//run the GC here
|
||||
go manager.GC()
|
||||
return manager
|
||||
}
|
||||
Reference in New Issue
Block a user