Documentation ¶
Overview ¶
Package redis for session provider
depend on github.com/go-redis/redis
go install github.com/go-redis/redis
Usage: import(
_ "github.com/whiliang/beego-multi-schema/v2/server/web/session/redis_cluster" "github.com/whiliang/beego-multi-schema/v2/server/web/session"
)
func init() { globalSessions, _ = session.NewManager("redis_cluster", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070;127.0.0.1:7071"}``) go globalSessions.GC() }
more docs: http://beego.vip/docs/module/session.md
Index ¶
- Variables
- type Provider
- func (rp *Provider) SessionAll() int
- func (rp *Provider) SessionDestroy(sid string) error
- func (rp *Provider) SessionExist(sid string) bool
- func (rp *Provider) SessionGC()
- func (rp *Provider) SessionInit(maxlifetime int64, savePath string) error
- func (rp *Provider) SessionRead(sid string) (session.Store, error)
- func (rp *Provider) 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 ¶
var MaxPoolSize = cluster.MaxPoolSize
MaxPoolSize redis_cluster max pool size
Functions ¶
This section is empty.
Types ¶
type Provider ¶
Provider redis_cluster session provider
func (*Provider) SessionAll ¶
SessionAll return all activeSession
func (*Provider) SessionDestroy ¶
SessionDestroy delete redis session by id
func (*Provider) SessionExist ¶
SessionExist check redis_cluster session exist by sid
func (*Provider) SessionInit ¶
SessionInit init redis_cluster session savepath like redis server addr,pool size,password,dbnum e.g. 127.0.0.1:6379;127.0.0.1:6380,100,test,0
func (*Provider) SessionRead ¶
SessionRead read redis_cluster session by sid
type SessionStore ¶
type SessionStore cluster.SessionStore
SessionStore redis_cluster session store
func (*SessionStore) Delete ¶
func (rs *SessionStore) Delete(key interface{}) error
Delete value in redis_cluster session
func (*SessionStore) Flush ¶
func (rs *SessionStore) Flush() error
Flush clear all values in redis_cluster session
func (*SessionStore) Get ¶
func (rs *SessionStore) Get(key interface{}) interface{}
Get value in redis_cluster session
func (*SessionStore) SessionID ¶
func (rs *SessionStore) SessionID() string
SessionID get redis_cluster session id
func (*SessionStore) SessionRelease ¶
func (rs *SessionStore) SessionRelease(w http.ResponseWriter)
SessionRelease save session values to redis_cluster
func (*SessionStore) Set ¶
func (rs *SessionStore) Set(key, value interface{}) error
Set value in redis_cluster session