Class CaffeineScheme
java.lang.Object
com.tangosol.coherence.config.scheme.AbstractScheme
com.tangosol.coherence.config.scheme.AbstractServiceScheme
com.tangosol.coherence.config.scheme.AbstractCachingScheme
com.tangosol.coherence.config.scheme.AbstractLocalCachingScheme<CaffeineCache>
com.tangosol.coherence.config.scheme.CaffeineScheme
- All Implemented Interfaces:
BackingMapManagerBuilder,BuilderCustomization<CaffeineCache>,MapBuilder,NamedCacheBuilder,ServiceBuilder,CachingScheme,ObservableCachingScheme,Scheme,ServiceScheme
The
CaffeineScheme class is responsible for building a fully
configured instance of a CaffeineCache. Note that a CaffeineCache
may be used as a stand-alone cache or as part of a backing map.
This class will automatically inject the following types and named values into realized classes that have been annotated with @Injectable.
-
BackingMapManagerContext(optionally named "manager-context") -
ConfigurableCacheFactory - Cache Name (as a
String.class named "cache-name") - Context
ClassLoader(optionally named "class-loader") -
ResourceRegistry -
CacheConfig - together with any other resource, named or otherwise, available
in the
ResourceRegistryprovided by theConfigurableCacheFactory.
- Since:
- 22.06
- Author:
- Aleks Seovic 2022.05.12
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tangosol.coherence.config.builder.MapBuilder
MapBuilder.Dependencies -
Field Summary
Fields inherited from class com.tangosol.coherence.config.scheme.AbstractServiceScheme
m_serviceDependenciesFields inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
DELIM_APPLICATION_SCOPE, DELIM_DOMAIN_PARTITION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetExpiryDelay(ParameterResolver resolver) Return the amount of time since the last update that entries are kept by the cache before being expired.getHighUnits(ParameterResolver resolver) Return the limit of cache size.Return the UnitCalculatorBuilder used to build a UnitCalculator.intgetUnitFactor(ParameterResolver resolver) Return the unit-factor element specifies the factor by which the units, low-units and high-units properties are adjusted.realizeMap(ParameterResolver resolver, MapBuilder.Dependencies dependencies) Realize aMapbased on the state of theMapBuilder, resolvable parameters and providedMapBuilder.Dependencies.voidsetExpiryDelay(Expression<Seconds> expr) Set the expiry delay.voidsetHighUnits(Expression<Units> expr) Set the high units.voidSet the UnitCalculatorBuilder.voidsetUnitFactor(Expression<Integer> expr) Set the unit factor.protected voidvalidate(ParameterResolver resolver) Validate the properties.Methods inherited from class com.tangosol.coherence.config.scheme.AbstractLocalCachingScheme
getCustomBuilder, getEventInterceptorBuilders, getServiceType, isRunningClusterNeeded, setCustomBuilderMethods inherited from class com.tangosol.coherence.config.scheme.AbstractCachingScheme
establishMapListeners, getDefaultParameterResolver, getListenerBuilder, realizeBackingMapManager, realizeCache, setListenerBuilderMethods inherited from class com.tangosol.coherence.config.scheme.AbstractServiceScheme
ensureService, getDefaultServiceName, getScopedServiceName, getScopeName, getServiceBuilder, getServiceDependencies, getServiceName, getXml, injectScopeNameIntoService, isAutoStart, realizeService, setAutoStart, setScopeName, setServiceDependencies, setServiceName, setXmlMethods inherited from class com.tangosol.coherence.config.scheme.AbstractScheme
getSchemeName, isAnonymous, setSchemeName, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.tangosol.coherence.config.scheme.Scheme
getSchemeName, isAnonymousMethods inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
getScopedServiceName, getServiceBuilder, getServiceName, isAutoStart
-
Constructor Details
-
CaffeineScheme
public CaffeineScheme()
-
-
Method Details
-
realizeMap
Description copied from class:AbstractCachingSchemeRealize aMapbased on the state of theMapBuilder, resolvable parameters and providedMapBuilder.Dependencies.- Specified by:
realizeMapin interfaceMapBuilder- Overrides:
realizeMapin classAbstractCachingScheme- Parameters:
resolver- theParameterResolverdependencies- theMapBuilder.Dependenciesfor realizing theMap- Returns:
- a
Map
-
getExpiryDelay
Return the amount of time since the last update that entries are kept by the cache before being expired. Entries that have expired are not accessible and are evicted the next time a client accesses the cache. Any attempt to read an expired entry results in a reloading of the entry from the CacheStore.- Parameters:
resolver- the ParameterResolver- Returns:
- the expiry delay
-
setExpiryDelay
Set the expiry delay.- Parameters:
expr- the expiry delay expression
-
getHighUnits
Return the limit of cache size. Contains the maximum number of units that can be placed n the cache before pruning occurs. An entry is the unit of measurement, unless it is overridden by an alternate unit-calculator. When this limit is exceeded, the cache begins the pruning process, evicting entries according to the eviction policy. Legal values are positive integers or zero. Zero implies no limit.- Parameters:
resolver- the ParameterResolver- Returns:
- the high units
-
setHighUnits
Set the high units.- Parameters:
expr- the high units expression
-
getUnitCalculatorBuilder
Return the UnitCalculatorBuilder used to build a UnitCalculator.- Returns:
- the unit calculator
-
setUnitCalculatorBuilder
Set the UnitCalculatorBuilder.- Parameters:
builder- the UnitCalculatorBuilder
-
getUnitFactor
Return the unit-factor element specifies the factor by which the units, low-units and high-units properties are adjusted. Using a BINARY unit calculator, for example, the factor of 1048576 could be used to count megabytes instead of bytes.- Parameters:
resolver- the ParameterResolver- Returns:
- the unit factor
-
setUnitFactor
Set the unit factor.- Parameters:
expr- the unit factor expression
-
validate
Validate the properties.- Overrides:
validatein classAbstractCachingScheme- Parameters:
resolver- the ParameterResolver needed to resolve expressions
-