session

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 11, 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 LedisProvider

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

LedisProvider represents a ledis session provider implementation.

func (*LedisProvider) Count

func (p *LedisProvider) Count() int

Count counts and returns number of sessions.

func (*LedisProvider) Destory

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

Destory deletes a session by session ID.

func (*LedisProvider) Exist

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

Exist returns true if session with given ID exists.

func (*LedisProvider) GC

func (p *LedisProvider) GC()

GC calls GC to clean expired sessions.

func (*LedisProvider) Init

func (p *LedisProvider) Init(expire int64, configs string) error

Init initializes ledis session provider. configs: data_dir=./app.db,db=0

func (*LedisProvider) Read

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

Read returns raw session store by session ID.

func (*LedisProvider) Regenerate

func (p *LedisProvider) Regenerate(oldsid, sid string) (_ session.RawStore, err error)

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

type LedisStore

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

LedisStore represents a ledis session store implementation.

func NewLedisStore

func NewLedisStore(c *ledis.DB, sid string, expire int64, kv map[interface{}]interface{}) *LedisStore

NewLedisStore creates and returns a ledis session store.

func (*LedisStore) Delete

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

Delete delete a key from session.

func (*LedisStore) Flush

func (s *LedisStore) Flush() error

Flush deletes all session data.

func (*LedisStore) Get

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

Get gets value by given key in session.

func (*LedisStore) ID

func (s *LedisStore) ID() string

ID returns current session ID.

func (*LedisStore) Release

func (s *LedisStore) Release() error

Release releases resource and save data to provider.

func (*LedisStore) Set

func (s *LedisStore) 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