beego: Index | Files

package redis_sentinel

import ""

Package redis for session provider

depend on

go install

Usage: import(

_ ""


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

more detail about params: please check the notes on the function SessionInit in this package


Package Files



var DefaultPoolSize = 100

DefaultPoolSize redis_sentinel default pool size

type Provider Uses

type Provider struct {
    SavePath string `json:"save_path"`
    Poolsize int    `json:"poolsize"`
    Password string `json:"password"`
    DbNum    int    `json:"db_num"`

    IdleTimeoutStr string `json:"idle_timeout"`

    IdleCheckFrequencyStr string `json:"idle_check_frequency"`
    MaxRetries            int    `json:"max_retries"`

    MasterName string `json:"master_name"`
    // contains filtered or unexported fields

Provider redis_sentinel session provider

func (*Provider) SessionAll Uses

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

SessionAll return all activeSession

func (*Provider) SessionDestroy Uses

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

SessionDestroy delete redis session by id

func (*Provider) SessionExist Uses

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

SessionExist check redis_sentinel session exist by sid

func (*Provider) SessionGC Uses

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

SessionGC Impelment method, no used.

func (*Provider) SessionInit Uses

func (rp *Provider) SessionInit(ctx context.Context, maxlifetime int64, cfgStr string) error

SessionInit init redis_sentinel session cfgStr like redis sentinel addr,pool size,password,dbnum,masterName e.g.;,100,1qaz2wsx,0,mymaster

func (*Provider) SessionRead Uses

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

SessionRead read redis_sentinel session by sid

func (*Provider) SessionRegenerate Uses

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

SessionRegenerate generate new sid for redis_sentinel session

type SessionStore Uses

type SessionStore struct {
    // contains filtered or unexported fields

SessionStore redis_sentinel session store

func (*SessionStore) Delete Uses

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

Delete value in redis_sentinel session

func (*SessionStore) Flush Uses

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

Flush clear all values in redis_sentinel session

func (*SessionStore) Get Uses

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

Get value in redis_sentinel session

func (*SessionStore) SessionID Uses

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

SessionID get redis_sentinel session id

func (*SessionStore) SessionRelease Uses

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

SessionRelease save session values to redis_sentinel

func (*SessionStore) Set Uses

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

Set value in redis_sentinel session

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