session

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemProvider

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

MemProvider represents a in-memory session provider implementation.

func (*MemProvider) Count

func (p *MemProvider) Count() int

Count counts and returns number of sessions.

func (*MemProvider) Destory

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

Destory deletes a session by session ID.

func (*MemProvider) Exist

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

Exist returns true if session with given ID exists.

func (*MemProvider) GC

func (p *MemProvider) GC()

GC calls GC to clean expired sessions.

func (*MemProvider) Init

func (p *MemProvider) Init(maxLifetime int64, _ string) error

Init initializes memory session provider.

func (*MemProvider) Read

func (p *MemProvider) Read(sid string) (_ session.RawStore, err error)

Read returns raw session store by session ID.

func (*MemProvider) Regenerate

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

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

type MemStore

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

MemStore represents a in-memory session store implementation.

func NewMemStore

func NewMemStore(sid string) *MemStore

NewMemStore creates and returns a memory session store.

func (*MemStore) Delete

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

Delete deletes a key from session.

func (*MemStore) Flush

func (s *MemStore) Flush() error

Flush deletes all session data.

func (*MemStore) Get

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

Get gets value by given key in session.

func (*MemStore) ID

func (s *MemStore) ID() string

ID returns current session ID.

func (*MemStore) Release

func (*MemStore) Release() error

Release releases resource and save data to provider.

func (*MemStore) Set

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

Set sets value to given key in session.

type VirtualSessionProvider

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

VirtualSessionProvider represents a shadowed session provider implementation.

func (*VirtualSessionProvider) Count

func (o *VirtualSessionProvider) Count() int

Count counts and returns number of sessions.

func (*VirtualSessionProvider) Destory

func (o *VirtualSessionProvider) Destory(sid string) error

Destory deletes a session by session ID.

func (*VirtualSessionProvider) Exist

func (o *VirtualSessionProvider) Exist(sid string) bool

Exist returns true if session with given ID exists.

func (*VirtualSessionProvider) GC

func (o *VirtualSessionProvider) GC()

GC calls GC to clean expired sessions.

func (*VirtualSessionProvider) Init

func (o *VirtualSessionProvider) Init(gclifetime int64, config string) error

Init initializes the cookie session provider with given root path.

func (*VirtualSessionProvider) Read

Read returns raw session store by session ID.

func (*VirtualSessionProvider) Regenerate

func (o *VirtualSessionProvider) Regenerate(oldsid, sid string) (session.RawStore, error)

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

type VirtualStore

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

VirtualStore represents a virtual session store implementation.

func NewVirtualStore

func NewVirtualStore(p *VirtualSessionProvider, sid string, kv map[interface{}]interface{}) *VirtualStore

NewVirtualStore creates and returns a virtual session store.

func (*VirtualStore) Delete

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

Delete delete a key from session.

func (*VirtualStore) Flush

func (s *VirtualStore) Flush() error

Flush deletes all session data.

func (*VirtualStore) Get

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

Get gets value by given key in session.

func (*VirtualStore) ID

func (s *VirtualStore) ID() string

ID returns current session ID.

func (*VirtualStore) Release

func (s *VirtualStore) Release() error

Release releases resource and save data to provider.

func (*VirtualStore) Set

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