memory

package
v4.75.2 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: MIT Imports: 7 Imported by: 0

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] []Item[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