Generic reference counted cache, where values are created on-demand and closed when no more references exist.
Provides a public API that uses Key, but transforms it to InternalKey for caching, usually for performance reasons.
Type parameters
- InitData
-
transient initialization data that will be passed to setup
Attributes
- Companion
- object
- Source
- RefCountedCache.scala
- Graph
-
- Supertypes
-
trait AutoCloseableclass Objecttrait Matchableclass Any
Members list
Type members
Inherited types
Attributes
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Value members
Concrete methods
Binary compatibility forwarder
Convert the public key to an internal key used for caching.
Maximum number of unused values to keep in the LRU cache. Set to 0 to disable caching of unused values (values are closed immediately when released).
Maximum number of unused values to keep in the LRU cache. Set to 0 to disable caching of unused values (values are closed immediately when released).
Attributes
- Source
- RefCountedCache.scala
Create a new value for the given key.
If true, a value can be used concurrently by multiple consumers (reference counted). If false, a value can only be used by one consumer at a time.
If true, a value can be used concurrently by multiple consumers (reference counted). If false, a value can only be used by one consumer at a time.
Attributes
- Source
- RefCountedCache.scala
Clean up a value when it is evicted from the cache.
Inherited methods
Returns true if the cache entry associated with the given key is still valid. If false, the entry will be removed from the cache and setup will be invoked.
Returns true if the cache entry associated with the given key is still valid. If false, the entry will be removed from the cache and setup will be invoked.
Attributes
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Attributes
- Definition Classes
-
CachedFactoryBase -> AutoCloseable
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Get a value for the given key, creating one if necessary. The caller must call release when done with the value.
Get a value for the given key, creating one if necessary. The caller must call release when done with the value.
Attributes
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Release a reference to the value associated with the given key. If this was the last reference, the value moves to the unused cache.
Release a reference to the value associated with the given key. If this was the last reference, the value moves to the unused cache.
Attributes
- Returns
-
Some(entry) if there are still active references (only possible in shared mode), None otherwise
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Release a reference to a specific value, matching by value identity. This should be used when shareValues = false and multiple entries may have the same key.
Release a reference to a specific value, matching by value identity. This should be used when shareValues = false and multiple entries may have the same key.
Attributes
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala
Get a value, use it in the provided block, then release it.
Get a value, use it in the provided block, then release it.
Attributes
- Inherited from:
- CachedFactoryBase
- Source
- CachedFactoryBase.scala