CachedFactoryWithInitData
mill.util.CachedFactoryWithInitData
abstract class CachedFactoryWithInitData[K, InitData, V] extends AutoCloseable
Manage the setup, teardown, and caching of objects of type V safely in a multithreaded environment.
The user provides the setup and teardown logic along with a maxCacheSize, and CachedFactory provides instances of V as requested using the withValue method. These instances are automatically constructed on-demand from the give key, cached with an LRU strategy, and destroyed when they are assertEventually evicted
Intended for relatively small caches approximately O(num-threads) in size that will typically get used in a build system, not intended for caching large amounts of entries
Type parameters
- InitData
-
the transient initialization data that will be passed to setup.
- K
-
the cache key. setup will be invoked if the key is not found in the cache.
- V
-
the cached value
Attributes
- Source
- CachedFactory.scala
- Graph
-
- Supertypes
-
trait AutoCloseableclass Objecttrait Matchableclass Any
- Known subtypes
Members list
In this article