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/lei006/beego/server/web/session/memcache" "github.com/lei006/beego/server/web/session"
)
func init() { globalSessions, _ = session.NewManager("memcache", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:11211"}``) go globalSessions.GC() }
Index ¶
- type MemProvider
- func (rp *MemProvider) SessionAll(context.Context) int
- func (rp *MemProvider) SessionDestroy(ctx context.Context, sid string) error
- func (rp *MemProvider) SessionExist(ctx context.Context, sid string) (bool, error)
- func (rp *MemProvider) SessionGC(context.Context)
- func (rp *MemProvider) SessionInit(ctx context.Context, maxlifetime int64, savePath string) error
- func (rp *MemProvider) SessionRead(ctx context.Context, sid string) (session.Store, error)
- func (rp *MemProvider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)
- type SessionStore
- func (rs *SessionStore) Delete(ctx context.Context, key interface{}) error
- func (rs *SessionStore) Flush(context.Context) error
- func (rs *SessionStore) Get(ctx context.Context, key interface{}) interface{}
- func (rs *SessionStore) SessionID(context.Context) string
- func (rs *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
- func (rs *SessionStore) Set(ctx context.Context, 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(context.Context) int
SessionAll return all activeSession
func (*MemProvider) SessionDestroy ¶
func (rp *MemProvider) SessionDestroy(ctx context.Context, sid string) error
SessionDestroy delete memcache session by id
func (*MemProvider) SessionExist ¶
SessionExist check memcache session exist by sid
func (*MemProvider) SessionGC ¶
func (rp *MemProvider) SessionGC(context.Context)
SessionGC Impelment method, no used.
func (*MemProvider) SessionInit ¶
SessionInit init memcache session savepath like e.g. 127.0.0.1:9090
func (*MemProvider) SessionRead ¶
SessionRead read memcache session by sid
func (*MemProvider) SessionRegenerate ¶
func (rp *MemProvider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)
SessionRegenerate generate new sid for memcache session
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore memcache session store
func (*SessionStore) Delete ¶
func (rs *SessionStore) Delete(ctx context.Context, key interface{}) error
Delete value in memcache session
func (*SessionStore) Flush ¶
func (rs *SessionStore) Flush(context.Context) error
Flush clear all values in memcache session
func (*SessionStore) Get ¶
func (rs *SessionStore) Get(ctx context.Context, key interface{}) interface{}
Get value in memcache session
func (*SessionStore) SessionID ¶
func (rs *SessionStore) SessionID(context.Context) string
SessionID get memcache session id
func (*SessionStore) SessionRelease ¶
func (rs *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
SessionRelease save session values to memcache