session

package
v0.0.0-...-2918666 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2014 License: Apache-2.0, MIT Imports: 6 Imported by: 0

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

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

func (rp *RedisProvider) SessionAll() int

@todo

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL