function to create new objects if not found in cache
function to be called once the value is not used any more
function generating additional keys the value should be reachable by
number of milliseconds to keep unused values in cache, before they are removed.
Acquires a value associated with key.
Acquires a value associated with key.
If the value was acquired by another thread and is present in the cache, it will be returned from cache.
If the value was not found in cache, a new value will be created by invoking create
function
and will be saved to the cache and associated with key
and other keys returned by invoking the
keys
function on the value.
Returns true if cache contains given key.
Removes all entries from the cache and destroys stored values by calling destroy
on them.
Removes all entries from the cache and destroys stored values by calling destroy
on them.
Warning - this is not thread-safe. You must not call this method if you know
the cache is in use.
Releases previously acquired value.
Releases previously acquired value. Once the value is released by all threads and
the releaseDelayMillis
timeout passes, the value is destroyed by calling destroy
function and
removed from the cache.
Shuts down the background deferred release
scheduler and forces all pending release tasks to be executed
(refCountedCache: StringAdd).self
(refCountedCache: StringFormat).self
(refCountedCache: ArrowAssoc[RefCountedCache[K, V]]).x
(Since version 2.10.0) Use leftOfArrow
instead
(refCountedCache: Ensuring[RefCountedCache[K, V]]).x
(Since version 2.10.0) Use resultOfEnsuring
instead
A lockless cache that caches values for multiple users and destroys them once all users release them. One value can be associated with many keys. Useful for sharing a costly resource.