Package de.hybris.platform.regioncache
Class DefaultCacheController
java.lang.Object
de.hybris.platform.regioncache.DefaultCacheController
- All Implemented Interfaces:
CacheController
Main point connecting platform with cache.
Class is responsible for:
Class is responsible for:
- Cache configuration: gathers cache regions, region resolvers and invalidation filters in one place.
- Resolves cache region using resolvers.
- Processes adding from cache.
- Processes invalidating cache units.
- Decides whether using cache registry or not.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLifecycleCallback(CacheLifecycleCallback callback) registers a lifecycle callback.voidclearCache(CacheRegion region) Clears cacheprotected voidexecuteOnAfterAddCallbacks(CacheKey key, Object value, CacheRegion region) protected voidexecuteOnAfterRemoveCallbacks(CacheKey key, Object value, CacheRegion region) protected voidexecuteOnEvictionCallbacks(CacheKey key, Object value, CacheRegion region) protected voidexecuteOnMissLoadCallbacks(CacheKey key, Object value, CacheRegion region) <T> TGets value stored in the cache.intFor testing onlyReturns all regions used in this controller.<T> TgetWithLoader(CacheKey key, CacheValueLoader<T> loader) Gets stored value from cache.voidinit()Reads configuration and creates registry for cache regions requiredvoidinvalidate(CacheKey key) Performs key invalidation from cache.voidregisterTenant(String tenantId) Deprecated, for removal: This API element is subject to removal in a future version.since 5.0voidLegacy method implemented just to implement lazy computing in AbstractCacheUnitvoidRemoves a registered lifecycle callback.Method used to resolve cache region.returns all regions handling queries.Returns cache regions for invalidation.voidsetCacheRegionProvider(CacheRegionProvider cacheRegionProvider) Spring initializationvoidsetGenerationalCacheDelegate(GenerationalCacheDelegate generationalCacheDelegate) voidsetRegionRegistryAllocationStrategy(RegionRegistryAllocationStrategy regionRegistryAllocationStrategy) Deprecated, for removal: This API element is subject to removal in a future version.since 5.0voidsetStatsEnabled(boolean enabled) Allows to enable or disable collecting of statistics for all regions in one step.unwrap()Deprecated, for removal: This API element is subject to removal in a future version.since 5.0
-
Constructor Details
-
DefaultCacheController
-
-
Method Details
-
init
@PostConstruct public void init()Reads configuration and creates registry for cache regions required -
invalidate
Performs key invalidation from cache.
Method checks invalidation filters and cache registry.- Specified by:
invalidatein interfaceCacheController
-
remove
Legacy method implemented just to implement lazy computing in AbstractCacheUnit- Specified by:
removein interfaceCacheController
-
getWithLoader
Gets stored value from cache. If value is not available loader is invoked.- Specified by:
getWithLoaderin interfaceCacheController- Throws:
CacheRegionNotSpecifiedExceptionCacheValueLoadException
-
get
Description copied from interface:CacheControllerGets value stored in the cache. If value is not already loaded returns NULL.- Specified by:
getin interfaceCacheController
-
resolveQueryRegionsForInvalidation
returns all regions handling queries. There may be more than one region handling queries. -
resolveRegionsForInvalidation
Returns cache regions for invalidation.
Only regions which can store key provided. -
resolveCacheRegionForAdd
Method used to resolve cache region.
Resolved cache region can be used as a parameter to invalidate() and getOrAdd().
It can improve performance when many operations are performed.
Parameter regionName should be stored in transaction (or other) context.
If the forInvalidation flag is set and no region name specified region proxy can be returned. This region proxy invalidates given key in all defined cache region.- Throws:
CacheRegionNotSpecifiedException
-
getResolvers
- Returns:
- the resolvers
-
getFilters
-
getRegions
Description copied from interface:CacheControllerReturns all regions used in this controller.- Specified by:
getRegionsin interfaceCacheController
-
clearCache
Clears cache- Specified by:
clearCachein interfaceCacheController
-
addLifecycleCallback
Description copied from interface:CacheControllerregisters a lifecycle callback. Callbacks are executed in order of registration.- Specified by:
addLifecycleCallbackin interfaceCacheController
-
removeLifecycleCallback
Description copied from interface:CacheControllerRemoves a registered lifecycle callback.- Specified by:
removeLifecycleCallbackin interfaceCacheController
-
getLifecycleCallbackCnt
public int getLifecycleCallbackCnt()For testing only -
executeOnAfterAddCallbacks
-
executeOnAfterRemoveCallbacks
-
executeOnEvictionCallbacks
-
executeOnMissLoadCallbacks
-
setStatsEnabled
public void setStatsEnabled(boolean enabled) Description copied from interface:CacheControllerAllows to enable or disable collecting of statistics for all regions in one step. Collection of cache statistics has negative impact on cache performance.- Specified by:
setStatsEnabledin interfaceCacheController
-
registerTenant
Deprecated, for removal: This API element is subject to removal in a future version.since 5.0Description copied from interface:CacheControllerSetups registry for tenant- Specified by:
registerTenantin interfaceCacheController
-
setCacheRegionProvider
Spring initialization -
setRegionRegistryAllocationStrategy
@Deprecated(since="5.0", forRemoval=true) public void setRegionRegistryAllocationStrategy(RegionRegistryAllocationStrategy regionRegistryAllocationStrategy) Deprecated, for removal: This API element is subject to removal in a future version.since 5.0 -
setGenerationalCacheDelegate
-
unwrap
Deprecated, for removal: This API element is subject to removal in a future version.since 5.0
-