-
Notifications
You must be signed in to change notification settings - Fork 4
/
session.go
34 lines (27 loc) · 919 Bytes
/
session.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package session
// InterfaceSession implementation
// -------------------------------
// GetID returns current session id
func (it DefaultSession) GetID() string {
return string(it)
}
// Get returns session value by a given key or nil - if not set
func (it DefaultSession) Get(key string) interface{} {
return SessionService.GetKey(string(it), key)
}
// Set assigns value to session key
func (it DefaultSession) Set(key string, value interface{}) {
SessionService.SetKey(string(it), key, value)
}
// IsEmpty checks if session contains data
func (it DefaultSession) IsEmpty() bool {
return SessionService.IsEmpty(it.GetID())
}
// Touch updates session last modification time to current moment
func (it DefaultSession) Touch() error {
return SessionService.Touch(string(it))
}
// Close makes current session instance expired
func (it DefaultSession) Close() error {
return SessionService.Close(string(it))
}