Version: v1.4.3 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2015 License: Apache-2.0 Imports: 6 Imported by: 0



package redis for session provider

depend on

go install

Usage: import(

_ ""


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

more docs:



This section is empty.


View Source
var MAX_POOL_SIZE = 100

redis max pool size


This section is empty.


type RedisProvider

type RedisProvider struct {
	// contains filtered or unexported fields

redis session provider

func (*RedisProvider) SessionAll

func (rp *RedisProvider) SessionAll() int


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) SessionGC

func (rp *RedisProvider) SessionGC()

Impelment method, no used.

func (*RedisProvider) SessionInit

func (rp *RedisProvider) SessionInit(maxlifetime int64, savePath string) error

init redis session savepath like redis server addr,pool size,password,dbnum e.g.,100,astaxie,0

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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL