session

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: BSD-3-Clause Imports: 6 Imported by: 1

README

Session component for Enorith

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotStarted = errors.New("session not started")
)

Functions

This section is empty.

Types

type Handler

type Handler interface {
	Init(id string) error
	Read(id string) ([]byte, error)
	Write(id string, data []byte) error
	Destroy(id string) error
	GC(maxLifeTime time.Duration) error
}

type Manager added in v0.0.4

type Manager struct {
	Handler Handler
	// contains filtered or unexported fields
}

func NewManager added in v0.0.4

func NewManager(handler Handler) *Manager

func (*Manager) GC added in v0.0.4

func (s *Manager) GC(maxLifeTime time.Duration) error

func (*Manager) Get added in v0.0.4

func (s *Manager) Get(id string) *Session

func (*Manager) Save added in v0.0.4

func (s *Manager) Save(id string) error

func (*Manager) Start added in v0.0.4

func (s *Manager) Start(id string) error

type Session added in v0.0.4

type Session struct {
	ID string
	TS time.Time
	// contains filtered or unexported fields
}

Session is a session data

func NewSession added in v0.0.4

func NewSession(id string) *Session

func (*Session) Get added in v0.0.4

func (s *Session) Get(key string, dest interface{}) error

func (*Session) Set added in v0.0.4

func (s *Session) Set(key string, dest interface{}) error

type SessionData added in v0.0.2

type SessionData map[string][]byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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