memstore

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 4 Imported by: 1

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