session

package
Version: v2.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2015 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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, configs string) (err error)

Init initializes redis session provider. configs: network=tcp,addr=:6379,password=macaron,db=0,pool_size=100,idle_timeout=180

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, err error)

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

type RedisStore

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

RedisStore represents a redis session store implementation.

func NewRedisStore

func NewRedisStore(c *redis.Client, sid string, dur time.Duration, kv map[interface{}]interface{}) *RedisStore

NewRedisStore creates and returns a redis session store.

func (*RedisStore) Delete

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

Delete delete a key from session.

func (*RedisStore) Flush

func (s *RedisStore) Flush() error

Flush deletes all session data.

func (*RedisStore) Get

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

Get gets value by given key in session.

func (*RedisStore) ID

func (s *RedisStore) ID() string

ID returns current session ID.

func (*RedisStore) Release

func (s *RedisStore) Release() error

Release releases resource and save data to provider.

func (*RedisStore) Set

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

Set sets value to given key in 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