memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxItems = 1_000
	DefaultTTL      = 10 * time.Minute
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxItems int
	TTL      time.Duration
}

type Memory

type Memory[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func New

func New[K comparable, V any](cfg Config) (*Memory[K, V], error)

func (*Memory[K, V]) Get

func (m *Memory[K, V]) Get(key K) (V, bool, error)

func (*Memory[K, V]) Set

func (m *Memory[K, V]) Set(key K, value V) error

Jump to

Keyboard shortcuts

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