Class CacheAndReuseStrategy<T extends FeatureInput>
Object
CacheAndReuseStrategy<T>
- Type Parameters:
T- feature-input type
- All Implemented Interfaces:
ReplaceStrategy<T>
public class CacheAndReuseStrategy<T extends FeatureInput>
extends Object
implements ReplaceStrategy<T>
Reuse an existing
FeatureCalculationInput, as stored in a least-recently used cache, and
without invalidating it.
If no existing input is already stored, create a new one.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionCacheAndReuseStrategy(CacheCreator cacheCreator) Create with a particularCacheCreator. -
Method Summary
Modifier and TypeMethodDescriptioncreateOrReuse(T input) Find or create aFeatureCalculationInputto associate withinput.getCache()The cache mapping a particular input to a correspondingFeatureCalculationInput.
-
Constructor Details
-
CacheAndReuseStrategy
Create with a particularCacheCreator.- Parameters:
cacheCreator- the cache-creator.
-
-
Method Details
-
createOrReuse
Description copied from interface:ReplaceStrategyFind or create aFeatureCalculationInputto associate withinput.- Specified by:
createOrReusein interfaceReplaceStrategy<T extends FeatureInput>- Parameters:
input- the input that aFeatureCalculationInputwill be associated with.- Returns:
- the
FeatureCalculationInput, either newly created, or reused from a previous call. - Throws:
OperationFailedException- if an error-state emerge
-
getCache
The cache mapping a particular input to a correspondingFeatureCalculationInput.
-