mirror of
https://github.com/kataras/iris.git
synced 2025-12-24 05:17:03 +00:00
Fix up for sessions
- Restore expiration state of the sessions - Add APIs to modify expire date - Free the timer for the session destroy task Former-commit-id: 4d796a9efba2c37cd3750275ac62c068ceb82be8
This commit is contained in:
@@ -1,17 +1,24 @@
|
||||
package sessions
|
||||
|
||||
import "time"
|
||||
|
||||
// Database is the interface which all session databases should implement
|
||||
// By design it doesn't support any type of cookie session like other frameworks,
|
||||
// I want to protect you, believe me, no context access (although we could)
|
||||
// The scope of the database is to session somewhere the sessions in order to
|
||||
// keep them after restarting the server, nothing more.
|
||||
// the values are sessiond by the underline session, the check for new sessions, or
|
||||
// 'this session value should added' are made automatically you are able just to set the values to your backend database with Load function.
|
||||
// the values are sessions by the underline session, the check for new sessions, or
|
||||
// 'this session value should added' are made automatically
|
||||
// you are able just to set the values to your backend database with Load function.
|
||||
// session database doesn't have any write or read access to the session, the loading of
|
||||
// the initial data is done by the Load(string) map[string]interfface{} function
|
||||
// the initial data is done by the Load(string) (map[string]interfface{}, *time.Time) function
|
||||
// synchronization are made automatically, you can register more than one session database
|
||||
// but the first non-empty Load return data will be used as the session values.
|
||||
// The Expire Date is given with data to save because the session entry must keep trace
|
||||
// of the expire date in the case of the server is restarted. So the server will recover
|
||||
// expiration state of session entry and it will track the expiration again.
|
||||
// If expireDate is nil, that's means that there is no expire date.
|
||||
type Database interface {
|
||||
Load(string) map[string]interface{}
|
||||
Update(string, map[string]interface{})
|
||||
Load(sid string) (datas map[string]interface{}, expireDate *time.Time)
|
||||
Update(sid string, datas map[string]interface{}, expireDate *time.Time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user