Documentation
¶
Index ¶
Constants ¶
View Source
const ( NameCrypter = "crypter" NameSigningKey = "signing_key" )
The names these caches report under; see the metrics package for the series. They are exported because whoever builds a cache names it: cache.MeteredLRU is generic and cannot name itself, and two caches built under the same name sum into one series.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[Key comparable, Value any] interface { Add(key Key, value Value) (evicted bool) Get(key Key) (value Value, ok bool) }
Cache is the read-write surface a caller needs from a cache, so a service can take one without taking a dependency on how it evicts or whether it meters.
type MeteredLRU ¶
type MeteredLRU[Key comparable, Value any] struct { // contains filtered or unexported fields }
func NewMeteredLRU ¶
func NewMeteredLRU[Key comparable, Value any](name string, size int, opts ...metrics.Option) (*MeteredLRU[Key, Value], error)
func (MeteredLRU[Key, Value]) Add ¶
func (c MeteredLRU[Key, Value]) Add(key Key, value Value) (evicted bool)
func (MeteredLRU[Key, Value]) Get ¶
func (c MeteredLRU[Key, Value]) Get(key Key) (value Value, ok bool)
Click to show internal directories.
Click to hide internal directories.