Documentation ¶
Index ¶
- func NewItem(sid string, data []byte, expire int32) *memcache.Item
- type MemcacheProvider
- func (p *MemcacheProvider) Count() int
- func (p *MemcacheProvider) Destory(sid string) error
- func (p *MemcacheProvider) Exist(sid string) bool
- func (p *MemcacheProvider) GC()
- func (p *MemcacheProvider) Init(expire int64, connStrs string) error
- func (p *MemcacheProvider) Read(sid string) (session.RawStore, error)
- func (p *MemcacheProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
- type MemcacheStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MemcacheProvider ¶
type MemcacheProvider struct {
// contains filtered or unexported fields
}
MemcacheProvider represents a memcache session provider implementation.
func (*MemcacheProvider) Count ¶
func (p *MemcacheProvider) Count() int
Count counts and returns number of sessions.
func (*MemcacheProvider) Destory ¶
func (p *MemcacheProvider) Destory(sid string) error
Destory deletes a session by session ID.
func (*MemcacheProvider) Exist ¶
func (p *MemcacheProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*MemcacheProvider) GC ¶
func (p *MemcacheProvider) GC()
GC calls GC to clean expired sessions.
func (*MemcacheProvider) Init ¶
func (p *MemcacheProvider) Init(expire int64, connStrs string) error
Init initializes memcache session provider. connStrs: 127.0.0.1:9090;127.0.0.1:9091
func (*MemcacheProvider) Read ¶
func (p *MemcacheProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*MemcacheProvider) Regenerate ¶
func (p *MemcacheProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
Regenerate regenerates a session store from old session ID to new one.
type MemcacheStore ¶
type MemcacheStore struct {
// contains filtered or unexported fields
}
MemcacheStore represents a memcache session store implementation.
func NewMemcacheStore ¶
func NewMemcacheStore(c *memcache.Client, sid string, expire int32, kv map[interface{}]interface{}) *MemcacheStore
NewMemcacheStore creates and returns a memcache session store.
func (*MemcacheStore) Delete ¶
func (s *MemcacheStore) Delete(key interface{}) error
Delete delete a key from session.
func (*MemcacheStore) Get ¶
func (s *MemcacheStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*MemcacheStore) Release ¶
func (s *MemcacheStore) Release() error
Release releases resource and save data to provider.
func (*MemcacheStore) Set ¶
func (s *MemcacheStore) Set(key, val interface{}) error
Set sets value to given key in session.