Documentation ¶
Overview ¶
Package ledis provide session Provider
Index ¶
- type Provider
- func (lp *Provider) SessionAll(context.Context) int
- func (lp *Provider) SessionDestroy(ctx context.Context, sid string) error
- func (lp *Provider) SessionExist(ctx context.Context, sid string) (bool, error)
- func (lp *Provider) SessionGC(context.Context)
- func (lp *Provider) SessionInit(ctx context.Context, maxlifetime int64, cfgStr string) error
- func (lp *Provider) SessionRead(ctx context.Context, sid string) (session.Store, error)
- func (lp *Provider) SessionRegenerate(ctx context.Context, oldsid, sid string) (session.Store, error)
- type SessionStore
- func (ls *SessionStore) Delete(ctx context.Context, key interface{}) error
- func (ls *SessionStore) Flush(context.Context) error
- func (ls *SessionStore) Get(ctx context.Context, key interface{}) interface{}
- func (ls *SessionStore) SessionID(context.Context) string
- func (ls *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
- func (ls *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 Provider ¶
type Provider struct { SavePath string `json:"save_path"` Db int `json:"db"` // contains filtered or unexported fields }
Provider ledis session provider
func (*Provider) SessionAll ¶
SessionAll return all active session
func (*Provider) SessionDestroy ¶
SessionDestroy delete ledis session by id
func (*Provider) SessionExist ¶
SessionExist check ledis session exist by sid
func (*Provider) SessionInit ¶
SessionInit init ledis session savepath like ledis server saveDataPath,pool size v1.x e.g. 127.0.0.1:6379,100 v2.x you should pass a json string e.g. { "save_path": "my save path", "db": 100}
func (*Provider) SessionRead ¶
SessionRead read ledis session by sid
type SessionStore ¶
type SessionStore struct {
// contains filtered or unexported fields
}
SessionStore ledis session store
func (*SessionStore) Delete ¶
func (ls *SessionStore) Delete(ctx context.Context, key interface{}) error
Delete value in ledis session
func (*SessionStore) Flush ¶
func (ls *SessionStore) Flush(context.Context) error
Flush clear all values in ledis session
func (*SessionStore) Get ¶
func (ls *SessionStore) Get(ctx context.Context, key interface{}) interface{}
Get value in ledis session
func (*SessionStore) SessionID ¶
func (ls *SessionStore) SessionID(context.Context) string
SessionID get ledis session id
func (*SessionStore) SessionRelease ¶
func (ls *SessionStore) SessionRelease(ctx context.Context, w http.ResponseWriter)
SessionRelease save session values to ledis