Documentation ¶
Overview ¶
Package redis for session provider
depend on github.com/garyburd/redigo/redis
go install github.com/garyburd/redigo/redis
Usage: import(
_ "github.com/astaxie/beego/session/redis" "github.com/astaxie/beego/session"
)
func init() { globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``) go globalSessions.GC() }
more docs: http://beego.me/docs/module/session.md
Index ¶
- Variables
- type Provider
- func (rp *Provider) SessionAll() int
- func (rp *Provider) SessionDestroy(sid string) error
- func (rp *Provider) SessionExist(sid string) bool
- func (rp *Provider) SessionGC()
- func (rp *Provider) SessionInit(maxlifetime int64, savePath string) error
- func (rp *Provider) SessionRead(sid string) (session.Store, error)
- func (rp *Provider) SessionRegenerate(oldsid, sid string) (session.Store, error)
- type SessionStore
- func (rs *SessionStore) Delete(key interface{}) error
- func (rs *SessionStore) Flush() error
- func (rs *SessionStore) Get(key interface{}) interface{}
- func (rs *SessionStore) SessionID() string
- func (rs *SessionStore) SessionRelease(w http.ResponseWriter)
- func (rs *SessionStore) Set(key, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
var MaxPoolSize = 100
MaxPoolSize redis max pool size
Functions ¶
This section is empty.
Types ¶
type Provider ¶ added in v1.7.1
type Provider struct {
// contains filtered or unexported fields
}
Provider redis session provider
func (*Provider) SessionAll ¶ added in v1.7.1
SessionAll return all activeSession
func (*Provider) SessionDestroy ¶ added in v1.7.1
SessionDestroy delete redis session by id
func (*Provider) SessionExist ¶ added in v1.7.1
SessionExist check redis session exist by sid
func (*Provider) SessionGC ¶ added in v1.7.1
func (rp *Provider) SessionGC()
SessionGC Impelment method, no used.
func (*Provider) SessionInit ¶ added in v1.7.1
SessionInit init redis session savepath like redis server addr,pool size,password,dbnum e.g. 127.0.0.1:6379,100,astaxie,0
func (*Provider) SessionRead ¶ added in v1.7.1
SessionRead read redis session by sid
type SessionStore ¶ added in v1.7.1
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore redis session store
func (*SessionStore) Delete ¶ added in v1.7.1
func (rs *SessionStore) Delete(key interface{}) error
Delete value in redis session
func (*SessionStore) Flush ¶ added in v1.7.1
func (rs *SessionStore) Flush() error
Flush clear all values in redis session
func (*SessionStore) Get ¶ added in v1.7.1
func (rs *SessionStore) Get(key interface{}) interface{}
Get value in redis session
func (*SessionStore) SessionID ¶ added in v1.7.1
func (rs *SessionStore) SessionID() string
SessionID get redis session id
func (*SessionStore) SessionRelease ¶ added in v1.7.1
func (rs *SessionStore) SessionRelease(w http.ResponseWriter)
SessionRelease save session values to redis
func (*SessionStore) Set ¶ added in v1.7.1
func (rs *SessionStore) Set(key, value interface{}) error
Set value in redis session