memory

package
v2.5.7 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 4 Imported by: 0

README

Memory

Memory provider implementation.

Better encoder:

  • Encode: session.MSGPEncode
  • Decode: session.MSGPDecode

WARNING

Don't use in production. Only for testing!

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct{}

Config provider settings

type Provider

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

Provider backend manager

func New

func New(cfg Config) (*Provider, error)

New returns a new memory provider configured

func (*Provider) Count

func (p *Provider) Count() int

Count returns the total of stored sessions

func (*Provider) Destroy

func (p *Provider) Destroy(id []byte) error

Destroy destroys the session from the given id

func (*Provider) GC

func (p *Provider) GC() error

GC destroys the expired sessions

func (*Provider) Get

func (p *Provider) Get(id []byte) ([]byte, error)

Get returns the data of the given session id

func (*Provider) NeedGC

func (p *Provider) NeedGC() bool

NeedGC indicates if the GC needs to be run

func (*Provider) Regenerate

func (p *Provider) Regenerate(id, newID []byte, expiration time.Duration) error

Regenerate updates the session id and expiration with the new session id of the the given current session id

func (*Provider) Save

func (p *Provider) Save(id, data []byte, expiration time.Duration) error

Save saves the session data and expiration from the given session id

Jump to

Keyboard shortcuts

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