Documentation ¶
Overview ¶
Package redis contains postgresql session provider based on go-redis client. Requirements:
redis client https://github.com/redis/go-redis
Index ¶
- Constants
- Variables
- type Provider
- func (pder *Provider) DestroyAllSessions(l io.Writer, logLev session.LogLevel)
- func (pder *Provider) GetMaxIdleTime() int64
- func (pder *Provider) GetMaxLifeTime() int64
- func (pder *Provider) GetSessionIDLen() int
- func (pder *Provider) InitProvider(provParams []interface{}) error
- func (pder *Provider) SessionClose(sid string) error
- func (pder *Provider) SessionDestroy(sid string) error
- func (pder *Provider) SessionGC(l io.Writer, logLev session.LogLevel)
- func (pder *Provider) SessionInit(sid string) (session.Session, error)
- func (pder *Provider) SessionRead(sid string) (session.Session, error)
- func (pder *Provider) SetMaxIdleTime(maxIdleTime int64)
- func (pder *Provider) SetMaxLifeTime(maxLifeTime int64)
- type SessionStore
- func (st *SessionStore) Delete(key string) error
- func (st *SessionStore) Flush() error
- func (st *SessionStore) Get(key string, val interface{}) error
- func (st *SessionStore) GetBool(key string) bool
- func (st *SessionStore) GetDate(key string) time.Time
- func (st *SessionStore) GetFloat(key string) float64
- func (st *SessionStore) GetInt(key string) int64
- func (st *SessionStore) GetString(key string) string
- func (st *SessionStore) Put(key string, value interface{}) error
- func (st *SessionStore) SessionID() string
- func (st *SessionStore) Set(key string, value interface{}) error
- func (st *SessionStore) TimeAccessed() time.Time
- func (st *SessionStore) TimeCreated() time.Time
Constants ¶
const LOG_PREF = "redis provider:"
const PROVIDER = "redis"
const SESS_ID_LEN = 36
Session key ID length.
Variables ¶
var EKeyNotFound = errors.New("key not found")
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider structure holds provider information.
func (*Provider) DestroyAllSessions ¶
func (*Provider) GetMaxIdleTime ¶
func (*Provider) GetMaxLifeTime ¶
func (*Provider) GetSessionIDLen ¶
func (*Provider) InitProvider ¶
InitProvider initializes postgresql provider. Function expects two parameters:
0 parameter: Redis url string, redis://<user>:<pass>@localhost:6379/<db> 1 parameter: redis namespace (username)
func (*Provider) SessionClose ¶
SessionClose is a stub
func (*Provider) SessionDestroy ¶
SessionDestroy destoys session by its ID.
func (*Provider) SessionGC ¶
SessionGC removes unused sessions. Handle max idle time only. Max life time is controled by REDIS.
func (*Provider) SessionInit ¶
SessionInit initializes session with given ID.
func (*Provider) SessionRead ¶
func (*Provider) SetMaxIdleTime ¶
func (*Provider) SetMaxLifeTime ¶
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore contains session id.
func (*SessionStore) Delete ¶
func (st *SessionStore) Delete(key string) error
Delete deletes session value from memmory by key.
func (*SessionStore) Flush ¶
func (st *SessionStore) Flush() error
func (*SessionStore) Get ¶
func (st *SessionStore) Get(key string, val interface{}) error
Get retrieves session value by its key. If there is no key error is returned.
func (*SessionStore) GetBool ¶
func (st *SessionStore) GetBool(key string) bool
GetBool returns bool value by key.
func (*SessionStore) GetDate ¶
func (st *SessionStore) GetDate(key string) time.Time
GetDate returns time.Time value by key.
func (*SessionStore) GetFloat ¶
func (st *SessionStore) GetFloat(key string) float64
GetFloat returns float value by key.
func (*SessionStore) GetInt ¶
func (st *SessionStore) GetInt(key string) int64
GetInt returns int value by key.
func (*SessionStore) GetString ¶
func (st *SessionStore) GetString(key string) string
GetString returns string value by key.
func (*SessionStore) Put ¶
func (st *SessionStore) Put(key string, value interface{}) error
Set sets redis value, updates access time.
func (*SessionStore) SessionID ¶
func (st *SessionStore) SessionID() string
SessionID returns session unique ID.
func (*SessionStore) Set ¶
func (st *SessionStore) Set(key string, value interface{}) error
Set sets redis value, updates access time.
func (*SessionStore) TimeAccessed ¶
func (st *SessionStore) TimeAccessed() time.Time
TimeCreated returns timeAccessed property.
func (*SessionStore) TimeCreated ¶
func (st *SessionStore) TimeCreated() time.Time
TimeCreated returns timeCreated property.