session

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: May 12, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, provide Provider)

Register makes a session provide available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Manager

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

func NewManager

func NewManager(provideName, cookieName string, maxlifetime int64) (*Manager, error)

func (*Manager) GC

func (manager *Manager) GC()

func (*Manager) SessionDestroy

func (manager *Manager) SessionDestroy(w http.ResponseWriter, r *http.Request)

Destroy sessionid

func (*Manager) SessionStart

func (manager *Manager) SessionStart(w http.ResponseWriter, r *http.Request) (session Session)

get Session

type Provider

type Provider interface {
	SessionInit(sid string) (Session, error)
	SessionRead(sid string) (Session, error)
	SessionDestroy(sid string) error
	SessionGC(maxlifetime int64)
}

type Session

type Session interface {
	Set(key, value interface{}) error //set session value
	Get(key interface{}) interface{}  //get session value
	Delete(key interface{}) error     //delete session value
	SessionID() string                //back current sessionID
}

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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