package
Version:
v1.33.0
Opens a new window with list of versions in this module.
Published: Jun 13, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Cache is a cache from K to V.
It uses double-locking to get values.
func (c *Cache[K, V]) GetOrAdd(key K, getUncached func() (V, error)) (V, error)
GetOrAdd gets the value for the key, or calls getUncached to get a new value,
and then caches the value.
If getUncached calls another Cache, the order of GetOrAdd calls between caches
must be preserved for lock ordering.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.