memstore

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MemStore

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

MemStore is an in-memory implementation of sessionup.Store. Since session data is being kept in memory, it will be lost once the application is closed.

func New

func New(d time.Duration) *MemStore

New returns a fresh instance of MemStore. Duration parameter determines how often the cleanup function wil be called to remove the expired sessions. Setting it to 0 will prevent cleanup from being activated.

func (*MemStore) Create

func (m *MemStore) Create(_ context.Context, s sessionup.Session) error

Create implements sessionup.Store interface's Create method.

func (*MemStore) DeleteByID

func (m *MemStore) DeleteByID(_ context.Context, id string) error

DeleteByID implements sessionup.Store interface's DeleteByID method.

func (*MemStore) DeleteByUserKey

func (m *MemStore) DeleteByUserKey(_ context.Context, key string, expID ...string) error

DeleteByUserKey implements sessionup.Store interface's DeleteByUserKey method.

func (*MemStore) FetchByID

func (m *MemStore) FetchByID(_ context.Context, id string) (sessionup.Session, bool, error)

FetchByID implements sessionup.Store interface's FetchByID method.

func (*MemStore) FetchByUserKey

func (m *MemStore) FetchByUserKey(_ context.Context, key string) ([]sessionup.Session, error)

FetchByUserKey implements sessionup.Store interface's FetchByUserKey method.

func (*MemStore) StopCleanup

func (m *MemStore) StopCleanup()

StopCleanup terminates the automatic cleanup process. Useful for testing and cases when store is used only temporary. In order to restart the cleanup, new store must be created.

Jump to

Keyboard shortcuts

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