Documentation ¶
Overview ¶
Package memcache for session provider
depend on github.com/bradfitz/gomemcache/memcache
go install github.com/bradfitz/gomemcache/memcache
Usage: import(
_ "github.com/astaxie/beego/session/memcache" "github.com/astaxie/beego/session"
)
func init() { globalSessions, _ = session.NewManager("memcache", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:11211"}``) go globalSessions.GC() }
more docs: http://beego.me/docs/module/session.md
Index ¶
- type MemProvider
- func (rp *MemProvider) SessionAll() int
- func (rp *MemProvider) SessionDestroy(sid string) error
- func (rp *MemProvider) SessionExist(sid string) bool
- func (rp *MemProvider) SessionGC()
- func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error
- func (rp *MemProvider) SessionRead(sid string) (session.Store, error)
- func (rp *MemProvider) 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 ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemProvider ¶
type MemProvider struct {
// contains filtered or unexported fields
}
MemProvider memcache session provider
func (*MemProvider) SessionAll ¶
func (rp *MemProvider) SessionAll() int
SessionAll return all activeSession
func (*MemProvider) SessionDestroy ¶
func (rp *MemProvider) SessionDestroy(sid string) error
SessionDestroy delete memcache session by id
func (*MemProvider) SessionExist ¶
func (rp *MemProvider) SessionExist(sid string) bool
SessionExist check memcache session exist by sid
func (*MemProvider) SessionGC ¶
func (rp *MemProvider) SessionGC()
SessionGC Impelment method, no used.
func (*MemProvider) SessionInit ¶
func (rp *MemProvider) SessionInit(maxlifetime int64, savePath string) error
SessionInit init memcache session savepath like e.g. 127.0.0.1:9090
type SessionStore ¶ added in v1.6.0
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore memcache session store
func (*SessionStore) Delete ¶ added in v1.6.0
func (rs *SessionStore) Delete(key interface{}) error
Delete value in memcache session
func (*SessionStore) Flush ¶ added in v1.6.0
func (rs *SessionStore) Flush() error
Flush clear all values in memcache session
func (*SessionStore) Get ¶ added in v1.6.0
func (rs *SessionStore) Get(key interface{}) interface{}
Get value in memcache session
func (*SessionStore) SessionID ¶ added in v1.6.0
func (rs *SessionStore) SessionID() string
SessionID get memcache session id
func (*SessionStore) SessionRelease ¶ added in v1.6.0
func (rs *SessionStore) SessionRelease(w http.ResponseWriter)
SessionRelease save session values to memcache
func (*SessionStore) Set ¶ added in v1.6.0
func (rs *SessionStore) Set(key, value interface{}) error
Set value in memcache session