T
- feature-inputpublic interface FeatureCalculationCache<T extends FeatureInput>
When a user calculates a a single feature, they often are calculating other features at the same time (on one or more objects). This creates possibilities for various different forms of caching of results, and different initialization strategies.
This class represents one such bunch of calculations. Different implementations provide different strategies.
Each calculation-cache may contain "child" caches for particular string identifiers. This provides a hierarchy of caches and sub-caches as many features change the underlying objects that are being calculated, and need separate space in the cache.
A call to {invalidate()
removes any existing caching (also in the children) and
guarantees the next calculation will be fresh.
Modifier and Type | Method and Description |
---|---|
FeatureCalculator<T> |
calculator()
A means of calculating feature values using this cache.
|
<V extends FeatureInput> |
childCacheFor(ChildCacheName childName,
Class<? extends FeatureInput> inputType,
CacheCreator cacheCreator)
Gets/creates a child-cache for a given name.
|
void |
initialize(FeatureInitialization initialization,
Logger logger)
Initializes the cache.
|
void |
invalidate()
Invalidates existing caches so the next calculation occurs freshly.
|
void |
invalidateExcept(Set<ChildCacheName> childCacheNames)
Invalidates existing caches so the next calculations occur freshly - except some particular
child-caches who are not invalidated.
|
void initialize(FeatureInitialization initialization, Logger logger)
initialization
- initialization for the feature.logger
- loggervoid invalidate()
void invalidateExcept(Set<ChildCacheName> childCacheNames)
childCacheNames
- the names of the child-caches who are not invalidated.FeatureCalculator<T> calculator()
FeatureCalculator
bound to this instance.<V extends FeatureInput> FeatureCalculationCache<V> childCacheFor(ChildCacheName childName, Class<? extends FeatureInput> inputType, CacheCreator cacheCreator)
This function trusts the caller to use the correct type for the child-cache.
V
- parameters-type of the child cache to foundchildName
- name of the child-cache.inputType
- the type of V
.cacheCreator
- factory for creating a cache.Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.