Documentation ¶
Overview ¶
package redis for session provider
depend on github.com/garyburd/redigo/redis
go install github.com/garyburd/redigo/redis
Usage: import(
_ "github.com/astaxie/beego/session/redis" "github.com/astaxie/beego/session"
)
func init() { globalSessions, _ = session.NewManager("redis", ``{"cookieName":"gosessionid","gclifetime":3600,"ProviderConfig":"127.0.0.1:7070"}``) go globalSessions.GC() }
more docs: http://beego.me/docs/module/session.md
Index ¶
- Variables
- type RedisProvider
- func (rp *RedisProvider) SessionAll() int
- func (rp *RedisProvider) SessionDestroy(sid string) error
- func (rp *RedisProvider) SessionExist(sid string) bool
- func (rp *RedisProvider) SessionGC()
- func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error
- func (rp *RedisProvider) SessionRead(sid string) (session.SessionStore, error)
- func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error)
- type RedisSessionStore
- func (rs *RedisSessionStore) Delete(key interface{}) error
- func (rs *RedisSessionStore) Flush() error
- func (rs *RedisSessionStore) Get(key interface{}) interface{}
- func (rs *RedisSessionStore) SessionID() string
- func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter)
- func (rs *RedisSessionStore) Set(key, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var MAX_POOL_SIZE = 100
redis max pool size
Functions ¶
This section is empty.
Types ¶
type RedisProvider ¶
type RedisProvider struct {
// contains filtered or unexported fields
}
redis session provider
func (*RedisProvider) SessionDestroy ¶
func (rp *RedisProvider) SessionDestroy(sid string) error
delete redis session by id
func (*RedisProvider) SessionExist ¶
func (rp *RedisProvider) SessionExist(sid string) bool
check redis session exist by sid
func (*RedisProvider) SessionInit ¶
func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error
init redis session savepath like redis server addr,pool size,password e.g. 127.0.0.1:6379,100,astaxie
func (*RedisProvider) SessionRead ¶
func (rp *RedisProvider) SessionRead(sid string) (session.SessionStore, error)
read redis session by sid
func (*RedisProvider) SessionRegenerate ¶
func (rp *RedisProvider) SessionRegenerate(oldsid, sid string) (session.SessionStore, error)
generate new sid for redis session
type RedisSessionStore ¶
type RedisSessionStore struct {
// contains filtered or unexported fields
}
redis session store
func (*RedisSessionStore) Delete ¶
func (rs *RedisSessionStore) Delete(key interface{}) error
delete value in redis session
func (*RedisSessionStore) Flush ¶
func (rs *RedisSessionStore) Flush() error
clear all values in redis session
func (*RedisSessionStore) Get ¶
func (rs *RedisSessionStore) Get(key interface{}) interface{}
get value in redis session
func (*RedisSessionStore) SessionID ¶
func (rs *RedisSessionStore) SessionID() string
get redis session id
func (*RedisSessionStore) SessionRelease ¶
func (rs *RedisSessionStore) SessionRelease(w http.ResponseWriter)
save session values to redis
func (*RedisSessionStore) Set ¶
func (rs *RedisSessionStore) Set(key, value interface{}) error
set value in redis session
Click to show internal directories.
Click to hide internal directories.