sessionStore

package
v0.0.0-...-05317bf Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Provider Provider
}

func (*Manager) Load

func (manager *Manager) Load(id string) (session *Session, err error)

func (*Manager) Save

func (manager *Manager) Save(session *Session) (err error)

type MemoryProvider

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

func NewMemoryProvider

func NewMemoryProvider() *MemoryProvider

func (*MemoryProvider) Delete

func (provider *MemoryProvider) Delete(Id string) (err error)

func (*MemoryProvider) Get

func (provider *MemoryProvider) Get(Id string) (Value []byte, Exist bool, err error)

func (*MemoryProvider) Set

func (provider *MemoryProvider) Set(Id string, Value []byte) (err error)

type Provider

type Provider interface {
	//caller should not modify Value
	Get(Id string) (Value []byte, Exist bool, err error)
	//caller should not modify Value
	Set(Id string, Value []byte) (err error)
	//when id not found,it should not report err ,just return silently
	Delete(Id string) (err error)
}

all call should thread safe not any transaction about single session

type Session

type Session struct {
	Id string
	// contains filtered or unexported fields
}

any call in this object not thread safe

func (*Session) DeleteAndNewSession

func (sess *Session) DeleteAndNewSession() (err error)

delete current session,delete all data in this session ,create a new one, it will panic if an error happened

func (*Session) DeleteSession

func (sess *Session) DeleteSession() (err error)

delete current session,and delete all data in this session

func (*Session) Get

func (sess *Session) Get(key string) (value interface{}, ok bool)

func (*Session) GetBool

func (sess *Session) GetBool(key string) bool

func (*Session) GetIntOrZero

func (sess *Session) GetIntOrZero(key string) (i int)

func (*Session) GetWithType

func (sess *Session) GetWithType(key string, out interface{}) (err error)

func (*Session) SaveAndReload

func (sess *Session) SaveAndReload() (err error)

save this Session and reload it from SessionProvider,should only used for test

func (*Session) Set

func (sess *Session) Set(key string, value interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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