Documentation ¶
Index ¶
- type DBProvider
- func (p *DBProvider) Count() int
- func (p *DBProvider) Destroy(sid string) error
- func (p *DBProvider) Exist(sid string) bool
- func (p *DBProvider) GC()
- func (p *DBProvider) Init(maxLifetime int64, connStr string) error
- func (p *DBProvider) Read(sid string) (session.RawStore, error)
- func (p *DBProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
- type DBStore
- type RedisProvider
- func (p *RedisProvider) Count() int
- func (p *RedisProvider) Destroy(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
- type Store
- type VirtualSessionProvider
- func (o *VirtualSessionProvider) Count() int
- func (o *VirtualSessionProvider) Destroy(sid string) error
- func (o *VirtualSessionProvider) Exist(sid string) bool
- func (o *VirtualSessionProvider) GC()
- func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error
- func (o *VirtualSessionProvider) Read(sid string) (session.RawStore, error)
- func (o *VirtualSessionProvider) Regenerate(oldsid, sid string) (session.RawStore, error)
- type VirtualStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBProvider ¶ added in v1.14.0
type DBProvider struct {
// contains filtered or unexported fields
}
DBProvider represents a DB session provider implementation.
func (*DBProvider) Count ¶ added in v1.14.0
func (p *DBProvider) Count() int
Count counts and returns number of sessions.
func (*DBProvider) Destroy ¶ added in v1.14.0
func (p *DBProvider) Destroy(sid string) error
Destroy deletes a session by session ID.
func (*DBProvider) Exist ¶ added in v1.14.0
func (p *DBProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*DBProvider) GC ¶ added in v1.14.0
func (p *DBProvider) GC()
GC calls GC to clean expired sessions.
func (*DBProvider) Init ¶ added in v1.14.0
func (p *DBProvider) Init(maxLifetime int64, connStr string) error
Init initializes DB session provider. connStr: username:password@protocol(address)/dbname?param=value
func (*DBProvider) Read ¶ added in v1.14.0
func (p *DBProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*DBProvider) Regenerate ¶ added in v1.14.0
func (p *DBProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)
Regenerate regenerates a session store from old session ID to new one.
type DBStore ¶ added in v1.14.0
type DBStore struct {
// contains filtered or unexported fields
}
DBStore represents a session store implementation based on the DB.
func NewDBStore ¶ added in v1.14.0
NewDBStore creates and returns a DB session store.
func (*DBStore) Get ¶ added in v1.14.0
func (s *DBStore) Get(key interface{}) interface{}
Get gets value by given key in session.
type RedisProvider ¶ added in v1.13.0
type RedisProvider struct {
// contains filtered or unexported fields
}
RedisProvider represents a redis session provider implementation.
func (*RedisProvider) Count ¶ added in v1.13.0
func (p *RedisProvider) Count() int
Count counts and returns number of sessions.
func (*RedisProvider) Destroy ¶ added in v1.13.0
func (p *RedisProvider) Destroy(sid string) error
Destroy deletes a session by session ID.
func (*RedisProvider) Exist ¶ added in v1.13.0
func (p *RedisProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*RedisProvider) GC ¶ added in v1.13.0
func (*RedisProvider) GC()
GC calls GC to clean expired sessions.
func (*RedisProvider) Init ¶ added in v1.13.0
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 ¶ added in v1.13.0
func (p *RedisProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*RedisProvider) Regenerate ¶ added in v1.13.0
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 ¶ added in v1.13.0
type RedisStore struct {
// contains filtered or unexported fields
}
RedisStore represents a redis session store implementation.
func NewRedisStore ¶ added in v1.13.0
func NewRedisStore(c redis.UniversalClient, prefix, sid string, dur time.Duration, kv map[interface{}]interface{}) *RedisStore
NewRedisStore creates and returns a redis session store.
func (*RedisStore) Delete ¶ added in v1.13.0
func (s *RedisStore) Delete(key interface{}) error
Delete delete a key from session.
func (*RedisStore) Flush ¶ added in v1.13.0
func (s *RedisStore) Flush() error
Flush deletes all session data.
func (*RedisStore) Get ¶ added in v1.13.0
func (s *RedisStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*RedisStore) ID ¶ added in v1.13.0
func (s *RedisStore) ID() string
ID returns current session ID.
func (*RedisStore) Release ¶ added in v1.13.0
func (s *RedisStore) Release() error
Release releases resource and save data to provider.
func (*RedisStore) Set ¶ added in v1.13.0
func (s *RedisStore) Set(key, val interface{}) error
Set sets value to given key in session.
type Store ¶ added in v1.14.0
type Store interface { Get(interface{}) interface{} Set(interface{}, interface{}) error Delete(interface{}) error }
Store represents a session store
type VirtualSessionProvider ¶
type VirtualSessionProvider struct {
// contains filtered or unexported fields
}
VirtualSessionProvider represents a shadowed session provider implementation.
func (*VirtualSessionProvider) Count ¶
func (o *VirtualSessionProvider) Count() int
Count counts and returns number of sessions.
func (*VirtualSessionProvider) Destroy ¶ added in v1.10.0
func (o *VirtualSessionProvider) Destroy(sid string) error
Destroy deletes a session by session ID.
func (*VirtualSessionProvider) Exist ¶
func (o *VirtualSessionProvider) Exist(sid string) bool
Exist returns true if session with given ID exists.
func (*VirtualSessionProvider) GC ¶
func (o *VirtualSessionProvider) GC()
GC calls GC to clean expired sessions.
func (*VirtualSessionProvider) Init ¶
func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error
Init initializes the cookie session provider with given root path.
func (*VirtualSessionProvider) Read ¶
func (o *VirtualSessionProvider) Read(sid string) (session.RawStore, error)
Read returns raw session store by session ID.
func (*VirtualSessionProvider) Regenerate ¶
func (o *VirtualSessionProvider) Regenerate(oldsid, sid string) (session.RawStore, error)
Regenerate regenerates a session store from old session ID to new one.
type VirtualStore ¶
type VirtualStore struct {
// contains filtered or unexported fields
}
VirtualStore represents a virtual session store implementation.
func NewVirtualStore ¶
func NewVirtualStore(p *VirtualSessionProvider, sid string, kv map[interface{}]interface{}) *VirtualStore
NewVirtualStore creates and returns a virtual session store.
func (*VirtualStore) Delete ¶
func (s *VirtualStore) Delete(key interface{}) error
Delete delete a key from session.
func (*VirtualStore) Get ¶
func (s *VirtualStore) Get(key interface{}) interface{}
Get gets value by given key in session.
func (*VirtualStore) Release ¶
func (s *VirtualStore) Release() error
Release releases resource and save data to provider.
func (*VirtualStore) Set ¶
func (s *VirtualStore) Set(key, val interface{}) error
Set sets value to given key in session.