Documentation ¶
Index ¶
- type LedisProvider
- func (p *LedisProvider) Count() int
- func (p *LedisProvider) Destroy(sid string) error
- func (p *LedisProvider) Exist(sid string) bool
- func (p *LedisProvider) GC()
- func (p *LedisProvider) Init(expire int64, configs string) error
- func (p *LedisProvider) Read(sid string) (session.RawStore, error)
- func (p *LedisProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
- type LedisStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LedisProvider ¶
type LedisProvider struct {
// contains filtered or unexported fields
}
LedisProvider represents a ledis session provider implementation.
func (*LedisProvider) Count ¶
func (p *LedisProvider) Count() int
Count counts and returns number of sessions.
func (*LedisProvider) Destroy ¶
func (p *LedisProvider) Destroy(sid string) error
Destroy deletes a session by session ID.
func (*LedisProvider) Exist ¶
func (p *LedisProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*LedisProvider) Init ¶
func (p *LedisProvider) Init(expire int64, configs string) error
Init initializes ledis session provider. configs: data_dir=./app.db,db=0
func (*LedisProvider) Read ¶
func (p *LedisProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*LedisProvider) Regenerate ¶
func (p *LedisProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
Regenerate regenerates a session store from old session ID to new one.
type LedisStore ¶
type LedisStore struct {
// contains filtered or unexported fields
}
LedisStore represents a ledis session store implementation.
func NewLedisStore ¶
func NewLedisStore(c *ledis.DB, sid string, expire int64, kv map[interface{}]interface{}) *LedisStore
NewLedisStore creates and returns a ledis session store.
func (*LedisStore) Delete ¶
func (s *LedisStore) Delete(key interface{}) error
Delete delete a key from session.
func (*LedisStore) Get ¶
func (s *LedisStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*LedisStore) Release ¶
func (s *LedisStore) Release() error
Release releases resource and save data to provider.
func (*LedisStore) Set ¶
func (s *LedisStore) Set(key, val interface{}) error
Set sets value to given key in session.