Documentation ¶
Overview ¶
Package state contains the go implementation for storing and loading the Session from the cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is the struct that contains the connection info for retrieving/saving The session data.
type Connection ¶
type Connection interface { Set(key string, value interface{}, expiration time.Duration) *redis.StatusCmd Get(key string) *redis.StringCmd Del(key ...string) *redis.IntCmd }
Connection is the interface used to interact with the Redis database
type Store ¶
type Store struct { ID string Expires uint64 Data session.Session // contains filtered or unexported fields }
Store is the struct that is used to load/store the session.
func (*Store) Clear ¶
Clear destroys the current loaded session and removes it from the backing store. It will also regenerate the session ID.
func (*Store) Delete ¶
Delete will clear the requested session from the backing store. Note: Delete does not clear the loaded session. The Clear method will take care of that. If the string passed in is nil, it will delete the session with an id the same as that of s.ID
func (*Store) GenerateSignature ¶
GenerateSignature will generate a new signature based on the Store ID and the cookie secret.
func (*Store) Load ¶
Load is used to try and get a session from the cache. If it succeeds it will load the session, otherwise it will return an error.
func (*Store) Store ¶
Store operates on a Store struct, saving it in the cache. Firstly, if the session data is nil, it will be set to an empty map. If the ID is not supplied, one will be generated. If expiry is its default value (0), it will be set on the store. The session will then be encoded, and an attempt made to save it.