memory

package
v4.88.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 7 Imported by: 1 module, 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 Cache

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

func New

func New[K comparable, V any](maxSize int) *Cache[K, V]

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(id K)

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(id K) (V, bool)

func (*Cache[K, V]) GetAll added in v4.66.2

func (c *Cache[K, V]) GetAll(ids []K, output []V) []K

func (*Cache[K, V]) Set

func (c *Cache[K, V]) Set(id K, value V, ttl time.Duration)

func (*Cache[K, V]) Start

func (c *Cache[K, V]) Start(ctx context.Context)

type ExpirationAction

type ExpirationAction int
const (
	AddItem    ExpirationAction = iota
	RemoveItem ExpirationAction = iota
)

type ExpirationQueue

type ExpirationQueue[K comparable] struct {
	// contains filtered or unexported fields
}

func NewExpirationQueue added in v4.84.6

func NewExpirationQueue[K comparable]() *ExpirationQueue[K]

func (*ExpirationQueue[K]) Index

func (eq *ExpirationQueue[K]) Index(id K) int

func (*ExpirationQueue[K]) Len

func (eq *ExpirationQueue[K]) Len() int

func (*ExpirationQueue[K]) Less

func (eq *ExpirationQueue[K]) Less(i, j int) bool

func (*ExpirationQueue[K]) Pop

func (eq *ExpirationQueue[K]) Pop() any

func (*ExpirationQueue[K]) Push

func (eq *ExpirationQueue[K]) Push(x any)

func (*ExpirationQueue[K]) Swap

func (eq *ExpirationQueue[K]) Swap(i, j int)

type ExpirationQueueAction

type ExpirationQueueAction[K comparable] struct {
	// contains filtered or unexported fields
}

type Item

type Item[K comparable] struct {
	// contains filtered or unexported fields
}

type LRUAction added in v4.66.5

type LRUAction int
const (
	Touch LRUAction = iota
	Add   LRUAction = iota
)

type LeastRecentlyUsedAction added in v4.66.5

type LeastRecentlyUsedAction[K comparable] struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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