session

package
v3.0.4+incompatible Latest Latest
Warning

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

Go to latest
Published: May 25, 2016 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewItem

func NewItem(sid string, data []byte, expire int32) *memcache.Item

Types

type MemcacheProvider

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

MemcacheProvider represents a memcache session provider implementation.

func (*MemcacheProvider) Count

func (p *MemcacheProvider) Count() int

Count counts and returns number of sessions.

func (*MemcacheProvider) Destory

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

Destory deletes a session by session ID.

func (*MemcacheProvider) Exist

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

Exist returns true if session with given ID exists.

func (*MemcacheProvider) GC

func (p *MemcacheProvider) GC()

GC calls GC to clean expired sessions.

func (*MemcacheProvider) Init

func (p *MemcacheProvider) Init(expire int64, connStrs string) error

Init initializes memcache session provider. connStrs: 127.0.0.1:9090;127.0.0.1:9091

func (*MemcacheProvider) Read

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

Read returns raw session store by session ID.

func (*MemcacheProvider) Regenerate

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

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

type MemcacheStore

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

MemcacheStore represents a memcache session store implementation.

func NewMemcacheStore

func NewMemcacheStore(c *memcache.Client, sid string, expire int32, kv map[interface{}]interface{}) *MemcacheStore

NewMemcacheStore creates and returns a memcache session store.

func (*MemcacheStore) Delete

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

Delete delete a key from session.

func (*MemcacheStore) Flush

func (s *MemcacheStore) Flush() error

Flush deletes all session data.

func (*MemcacheStore) Get

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

Get gets value by given key in session.

func (*MemcacheStore) ID

func (s *MemcacheStore) ID() string

ID returns current session ID.

func (*MemcacheStore) Release

func (s *MemcacheStore) Release() error

Release releases resource and save data to provider.

func (*MemcacheStore) Set

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