Documentation ¶
Overview ¶
Package cache implements a cache. The cache hold 256 shards, each shard holds a cache: a map with a mutex. There is no fancy expunge algorithm, it just randomly evicts elements when it gets full.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T any] struct { // contains filtered or unexported fields }
Cache is cache.
func (*Cache[T]) GetOrPut ¶
GetOrPut returns the element under key if it exists, or else stores newEl there. This operation is atomic.
Click to show internal directories.
Click to hide internal directories.