session

package
v2.0.0-beta1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2015 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

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
}

RedisProvider represents a redis session provider implementation.

func (*RedisProvider) Count

func (p *RedisProvider) Count() int

Count counts and returns number of sessions.

func (*RedisProvider) Destory

func (p *RedisProvider) Destory(sid string) error

Destory deletes a session by session ID.

func (*RedisProvider) Exist

func (p *RedisProvider) Exist(sid string) bool

Exist returns true if session with given ID exists.

func (*RedisProvider) GC

func (_ *RedisProvider) GC()

GC calls GC to clean expired sessions.

func (*RedisProvider) Init

func (p *RedisProvider) Init(maxlifetime int64, connStr string) error

Init initializes memory session provider. connStr: <redis server addr>,<pool size>,<password> e.g. 127.0.0.1:6379,100,macaron

func (*RedisProvider) Read

func (p *RedisProvider) Read(sid string) (session.RawStore, error)

Read returns raw session store by session ID.

func (*RedisProvider) Regenerate

func (p *RedisProvider) Regenerate(oldsid, sid string) (session.RawStore, error)

Regenerate regenerates a session store from old session ID to new one.

type RedisSessionStore

type RedisSessionStore struct {
	// contains filtered or unexported fields
}

RedisSessionStore represents a redis session store implementation.

func (*RedisSessionStore) Delete

func (s *RedisSessionStore) Delete(key interface{}) error

Delete delete a key from session.

func (*RedisSessionStore) Flush

func (s *RedisSessionStore) Flush() error

Flush deletes all session data.

func (*RedisSessionStore) Get

func (s *RedisSessionStore) Get(key interface{}) interface{}

Get gets value by given key in session.

func (*RedisSessionStore) ID

func (s *RedisSessionStore) ID() string

ID returns current session ID.

func (*RedisSessionStore) Release

func (s *RedisSessionStore) Release() error

Release releases resource and save data to provider.

func (*RedisSessionStore) Set

func (s *RedisSessionStore) Set(key, val interface{}) error

Set sets value to given key in session.

Jump to

Keyboard shortcuts

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