beego: Index | Files

package memcache

import ""

Package memcache for session provider

depend on

go install

Usage: import(

_ ""


func init() {
	globalSessions, _ = session.NewManager("memcache", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":""}``)
	go globalSessions.GC()

more docs:


Package Files


type MemProvider Uses

type MemProvider struct {
    // contains filtered or unexported fields

MemProvider memcache session provider

func (*MemProvider) SessionAll Uses

func (rp *MemProvider) SessionAll(context.Context) int

SessionAll return all activeSession

func (*MemProvider) SessionDestroy Uses

func (rp *MemProvider) SessionDestroy(ctx context.Context, sid string) error

SessionDestroy delete memcache session by id

func (*MemProvider) SessionExist Uses

func (rp *MemProvider) SessionExist(ctx context.Context, sid string) (bool, error)

SessionExist check memcache session exist by sid

func (*MemProvider) SessionGC Uses

func (rp *MemProvider) SessionGC(context.Context)

SessionGC Impelment method, no used.

func (*MemProvider) SessionInit Uses

func (rp *MemProvider) SessionInit(ctx context.Context, maxlifetime int64, savePath string) error

SessionInit init memcache session savepath like e.g.

func (*MemProvider) SessionRead Uses

func (rp *MemProvider) SessionRead(ctx context.Context, sid string) (session.Store, error)

SessionRead read memcache session by sid

func (*MemProvider) SessionRegenerate Uses

func (rp *MemProvider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)

SessionRegenerate generate new sid for memcache session

type SessionStore Uses

type SessionStore struct {
    // contains filtered or unexported fields

SessionStore memcache session store

func (*SessionStore) Delete Uses

func (rs *SessionStore) Delete(ctx context.Context, key interface{}) error

Delete value in memcache session

func (*SessionStore) Flush Uses

func (rs *SessionStore) Flush(context.Context) error

Flush clear all values in memcache session

func (*SessionStore) Get Uses

func (rs *SessionStore) Get(ctx context.Context, key interface{}) interface{}

Get value in memcache session

func (*SessionStore) SessionID Uses

func (rs *SessionStore) SessionID(context.Context) string

SessionID get memcache session id

func (*SessionStore) SessionRelease Uses

func (rs *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)

SessionRelease save session values to memcache

func (*SessionStore) Set Uses

func (rs *SessionStore) Set(ctx context.Context, key, value interface{}) error

Set value in memcache session

Package memcache imports 6 packages (graph) and is imported by 1 packages. Updated 2020-11-07. Refresh now. Tools for package owners.