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 { Sizer // 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) // Values returns a slice of all values in the cache. // The slice must be safe to modify by the caller. Values() []V // Keys returns a slice of all trace IDs in the cache Keys() []pcommon.TraceID // Clear removes all entry from the cache Clear() }
Cache is a cache using a pcommon.TraceID as the key and any generic type as the value.
func NewLRUCache ¶
func NewLRUCache[V any](size int, onEvicted func(pcommon.TraceID, V), telemetry *metadata.TelemetryBuilder) (Cache[V], error)
NewLRUCache returns a new lruCache. The size parameter indicates the amount of keys the cache will hold before it starts evicting the least recently used key.
func NewNopDecisionCache ¶
Click to show internal directories.
Click to hide internal directories.