Class DefaultAsCacheStrategy
- java.lang.Object
-
- de.hybris.platform.adaptivesearch.strategies.impl.DefaultAsCacheStrategy
-
- All Implemented Interfaces:
AsCacheStrategy,org.springframework.beans.factory.InitializingBean
public class DefaultAsCacheStrategy extends java.lang.Object implements AsCacheStrategy, org.springframework.beans.factory.InitializingBean
Default implementation ofAsCacheStrategythat uses the region cache from the platform.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classDefaultAsCacheStrategy.HybrisAsCacheKey
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringAS_CACHE_ENABLED_KEYprotected static java.lang.StringAS_CALCULATION_CACHE_ENABLED_KEYprotected static java.lang.StringAS_LOAD_CACHE_ENABLED_KEYprotected static java.lang.StringAS_MERGE_CACHE_ENABLED_KEY
-
Constructor Summary
Constructors Constructor Description DefaultAsCacheStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()voidclear()Clears the cache by removing all cached entries.CacheRegiongetCacheRegion()ConfigurationServicegetConfigurationService()longgetHits()Returns the hit count.longgetMisses()Returns the miss count.longgetSize()Returns number of elements currently in the cache.protected java.lang.StringgetTenantId()TenantServicegetTenantService()<V> VgetWithLoader(AsCacheKey cacheKey, java.util.function.Function<AsCacheKey,V> valueLoader)Returns the value in the cache for the given key.booleanisEnabled(AsCacheScope cacheScope)Checks if the cache is enabled for the givenAsCacheScope.protected voidloadCacheSettings()voidsetCacheRegion(CacheRegion cacheRegion)voidsetConfigurationService(ConfigurationService configurationService)voidsetTenantService(TenantService tenantService)
-
-
-
Field Detail
-
AS_CACHE_ENABLED_KEY
protected static final java.lang.String AS_CACHE_ENABLED_KEY
- See Also:
- Constant Field Values
-
AS_LOAD_CACHE_ENABLED_KEY
protected static final java.lang.String AS_LOAD_CACHE_ENABLED_KEY
- See Also:
- Constant Field Values
-
AS_CALCULATION_CACHE_ENABLED_KEY
protected static final java.lang.String AS_CALCULATION_CACHE_ENABLED_KEY
- See Also:
- Constant Field Values
-
AS_MERGE_CACHE_ENABLED_KEY
protected static final java.lang.String AS_MERGE_CACHE_ENABLED_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet()
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
loadCacheSettings
protected void loadCacheSettings()
-
isEnabled
public boolean isEnabled(AsCacheScope cacheScope)
Description copied from interface:AsCacheStrategyChecks if the cache is enabled for the givenAsCacheScope.- Specified by:
isEnabledin interfaceAsCacheStrategy- Returns:
trueif the cache is enabled,falseotherwise
-
getWithLoader
public <V> V getWithLoader(AsCacheKey cacheKey, java.util.function.Function<AsCacheKey,V> valueLoader)
Description copied from interface:AsCacheStrategyReturns the value in the cache for the given key. If the key is null or the value is not yet in the cache, valueLoader will be used to load the missing value.- Specified by:
getWithLoaderin interfaceAsCacheStrategy- Parameters:
cacheKey- - the cache keyvalueLoader- - function to load values- Returns:
- the cached value
-
clear
public void clear()
Description copied from interface:AsCacheStrategyClears the cache by removing all cached entries.- Specified by:
clearin interfaceAsCacheStrategy
-
getSize
public long getSize()
Description copied from interface:AsCacheStrategyReturns number of elements currently in the cache.- Specified by:
getSizein interfaceAsCacheStrategy
-
getHits
public long getHits()
Description copied from interface:AsCacheStrategyReturns the hit count.- Specified by:
getHitsin interfaceAsCacheStrategy
-
getMisses
public long getMisses()
Description copied from interface:AsCacheStrategyReturns the miss count.- Specified by:
getMissesin interfaceAsCacheStrategy
-
getTenantId
protected java.lang.String getTenantId()
-
getTenantService
public TenantService getTenantService()
-
setTenantService
public void setTenantService(TenantService tenantService)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getCacheRegion
public CacheRegion getCacheRegion()
-
setCacheRegion
public void setCacheRegion(CacheRegion cacheRegion)
-
-