Documentation ¶
Index ¶
- Variables
- type RedisProvider
- func (p *RedisProvider) Count() int
- func (p *RedisProvider) Destory(sid string) error
- func (p *RedisProvider) Exist(sid string) bool
- func (_ *RedisProvider) GC()
- func (p *RedisProvider) Init(maxlifetime int64, connStr string) error
- func (p *RedisProvider) Read(sid string) (session.RawStore, error)
- func (p *RedisProvider) Regenerate(oldsid, sid string) (session.RawStore, error)
- type RedisSessionStore
- func (s *RedisSessionStore) Delete(key interface{}) error
- func (s *RedisSessionStore) Flush() error
- func (s *RedisSessionStore) Get(key interface{}) interface{}
- func (s *RedisSessionStore) ID() string
- func (s *RedisSessionStore) Release() error
- func (s *RedisSessionStore) Set(key, val interface{}) error
Constants ¶
This section is empty.
Variables ¶
var MAX_POOL_SIZE = 100
redis max pool size
Functions ¶
This section is empty.
Types ¶
type RedisProvider ¶
type RedisProvider struct {
// contains filtered or unexported fields
}
RedisProvider represents a redis session provider implementation.
func (*RedisProvider) Count ¶
func (p *RedisProvider) Count() int
Count counts and returns number of sessions.
func (*RedisProvider) Destory ¶
func (p *RedisProvider) Destory(sid string) error
Destory deletes a session by session ID.
func (*RedisProvider) Exist ¶
func (p *RedisProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*RedisProvider) Init ¶
func (p *RedisProvider) Init(maxlifetime int64, connStr string) error
Init initializes memory session provider. connStr: <redis server addr>,<pool size>,<password> e.g. 127.0.0.1:6379,100,macaron
func (*RedisProvider) Read ¶
func (p *RedisProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*RedisProvider) Regenerate ¶
func (p *RedisProvider) Regenerate(oldsid, sid string) (session.RawStore, error)
Regenerate regenerates a session store from old session ID to new one.
type RedisSessionStore ¶
type RedisSessionStore struct {
// contains filtered or unexported fields
}
RedisSessionStore represents a redis session store implementation.
func (*RedisSessionStore) Delete ¶
func (s *RedisSessionStore) Delete(key interface{}) error
Delete delete a key from session.
func (*RedisSessionStore) Flush ¶
func (s *RedisSessionStore) Flush() error
Flush deletes all session data.
func (*RedisSessionStore) Get ¶
func (s *RedisSessionStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*RedisSessionStore) ID ¶
func (s *RedisSessionStore) ID() string
ID returns current session ID.
func (*RedisSessionStore) Release ¶
func (s *RedisSessionStore) Release() error
Release releases resource and save data to provider.
func (*RedisSessionStore) Set ¶
func (s *RedisSessionStore) Set(key, val interface{}) error
Set sets value to given key in session.