Documentation ¶
Index ¶
- 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, configs string) (err error)
- func (p *RedisProvider) Read(sid string) (session.RawStore, error)
- func (p *RedisProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
- type RedisStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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, configs string) (err error)
Init initializes redis session provider. configs: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180,prefix=session;
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, err error)
Regenerate regenerates a session store from old session ID to new one.
type RedisStore ¶
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore represents a redis session store implementation.
func NewRedisStore ¶
func NewRedisStore(c *redis.Client, prefix, sid string, dur time.Duration, kv map[interface{}]interface{}) *RedisStore
NewRedisStore creates and returns a redis session store.
func (*RedisStore) Delete ¶
func (s *RedisStore) Delete(key interface{}) error
Delete delete a key from session.
func (*RedisStore) Get ¶
func (s *RedisStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*RedisStore) Release ¶
func (s *RedisStore) Release() error
Release releases resource and save data to provider.
func (*RedisStore) Set ¶
func (s *RedisStore) Set(key, val interface{}) error
Set sets value to given key in session.