store

package
v0.160.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store satisfies the session store interface for storing sessions in a custom backend.

func NewSessionStore

func NewSessionStore(sessionLifetime time.Duration) (*Store, error)

NewSessionStore sets up a new session store for use by the server.

func (*Store) All

func (s *Store) All() (map[string][]byte, error)

func (*Store) AllCtx

func (s *Store) AllCtx(ctx context.Context) (map[string][]byte, error)

AllCtx should return a map containing data for all active sessions (i.e. sessions which have not expired). The map key should be the session token and the map value should be the session data. If no active sessions exist this should return an empty (not nil) map.

func (*Store) Commit

func (s *Store) Commit(token string, b []byte, expiry time.Time) error

func (*Store) CommitCtx

func (s *Store) CommitCtx(ctx context.Context, token string, data []byte, expiry time.Time) error

CommitCtx should add the session token and data to the store, with the given expiry time. If the session token already exists, then the data and expiry time should be overwritten.

func (*Store) Delete

func (s *Store) Delete(token string) error

func (*Store) DeleteCtx

func (s *Store) DeleteCtx(ctx context.Context, token string) error

DeleteCtx should remove the session token and corresponding data from the session store. If the token does not exist then Delete should be a no-op and return nil (not an error).

func (*Store) Find

func (s *Store) Find(token string) ([]byte, bool, error)

func (*Store) FindCtx

func (s *Store) FindCtx(ctx context.Context, token string) ([]byte, bool, error)

FindCtx should return the data for a session token from the store. If the session token is not found or is expired, the found return value should be false (and the err return value should be nil). Similarly, tampered or malformed tokens should result in a found return value of false and a nil err value. The err return value should be used for system errors only.

Jump to

Keyboard shortcuts

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