cache

package
v0.112.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 3 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[V any] interface {
	// Get returns the value for the given id, and a boolean to indicate whether the key was found.
	// If the key is not present, the zero value is returned.
	Get(id pcommon.TraceID) (V, bool)
	// Put sets the value for a given id
	Put(id pcommon.TraceID, v V)
	// Delete deletes the value for the given id
	Delete(id pcommon.TraceID)
}

Cache is a cache using a pcommon.TraceID as the key and any generic type as the value.

func NewLRUDecisionCache

func NewLRUDecisionCache[V any](size int) (Cache[V], error)

NewLRUDecisionCache returns a new lruDecisionCache. The size parameter indicates the amount of keys the cache will hold before it starts evicting the least recently used key.

func NewNopDecisionCache

func NewNopDecisionCache[V any]() Cache[V]

Jump to

Keyboard shortcuts

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