T
- feature-input typepublic class CacheAndReuseStrategy<T extends FeatureInput> extends Object implements ReplaceStrategy<T>
FeatureCalculationInput
, as stored in a least-recently used cache, and
without invalidating it.
If no existing input is already stored, create a new one.
Constructor and Description |
---|
CacheAndReuseStrategy(CacheCreator cacheCreator)
Create with a particular
CacheCreator . |
Modifier and Type | Method and Description |
---|---|
FeatureCalculationInput<T> |
createOrReuse(T input)
Find or create a
FeatureCalculationInput to associate with input . |
LRUCache<T,FeatureCalculationInput<T>> |
getCache()
The cache mapping a particular input to a corresponding
FeatureCalculationInput . |
public CacheAndReuseStrategy(CacheCreator cacheCreator)
CacheCreator
.cacheCreator
- the cache-creator.public FeatureCalculationInput<T> createOrReuse(T input) throws OperationFailedException
ReplaceStrategy
FeatureCalculationInput
to associate with input
.createOrReuse
in interface ReplaceStrategy<T extends FeatureInput>
input
- the input that a FeatureCalculationInput
will be associated with.FeatureCalculationInput
, either newly created, or reused from a previous
call.OperationFailedException
- if an error-state emergepublic LRUCache<T,FeatureCalculationInput<T>> getCache()
FeatureCalculationInput
.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.