memory

package
v0.0.0-...-9d85d00 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 6 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
}

func NewStore

func NewStore(expiration time.Duration) *Store

NewStore creates a new Store instance. The expiration parameter specifies the duration for which the cached values

func (*Store) Generate

func (s *Store) Generate(ctx context.Context, id string) (session.Session, error)

Generate creates a new session with the given ID and returns it. It also stores the session in the memory cache with an expiration time.

func (*Store) Get

func (s *Store) Get(ctx context.Context, id string) (session.Session, error)

Get retrieves a session from the store by its ID. It returns the session if found, otherwise it returns an error.

func (*Store) Refresh

func (s *Store) Refresh(ctx context.Context, id string) error

Refresh updates the expiration time of a session in the store. It takes a context and an ID as input and returns an error if the session is not found.

func (*Store) Remove

func (s *Store) Remove(ctx context.Context, id string) error

Remove removes an item from the store by its ID.

Jump to

Keyboard shortcuts

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