Package de.hybris.platform.cache
Class AbstractCacheUnit
java.lang.Object
de.hybris.platform.cache.AbstractCacheUnit
- All Implemented Interfaces:
CacheValueLoader
- Direct Known Subclasses:
AbstractRegioncacheRegistrableUnit,AnonymousCacheUnit,CustomCacheUnit,CustomCacheUnit,DefaultSLDDataContainerProvider.SLDItemBulkLoadUnit,DefaultSLDDataContainerProvider.SLDItemLoadUnit,FinderResult,GenericBMPBean.GenericItemEntityStateCacheUnit,IsItemAliveCheckUnit,JaloItemCacheUnit,JaloTypeCacheUnit,RelationCacheUnit,SLDPermissionManagementStrategy.AclCacheUnit
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCacheUnit(Cache cache) AbstractCacheUnit(Cache cache, Tenant tenant) AbstractCacheUnit(Cache cache, String tenantId) For testing -
Method Summary
Modifier and TypeMethodDescriptionvoidabstract Objectcompute()abstract Object[]final booleanvoidfinal Objectget()protected CachegetCache()intReturns the number of elements of the key that are elements of the invalidation topic key.getKey()final Object[]CacheValueLoader<? extends AbstractCacheUnit>final inthashCode()protected voidThis method allows direct setting of the value (without execution ofcompute()); it can be used if the value is available as result of some other operation; callers guarantee that the given value is equal to the Object that would be returned by a call to compute The new value will only be set if the object is not already in the cache.voidinvalidate(int invalidationType) mark the Cache Unit to be invalidated upon commit invalidationType is one of the constants (modified or remove)booleanbooleanWe do not perform compute not to hit database several times from different threads.
Another reason is to keep lifecycle of hooks in the same order.voidtoString()protected booleanuseCache()
-
Field Details
-
INVALIDATIONTYPE_MODIFIED
public static final int INVALIDATIONTYPE_MODIFIED- See Also:
-
INVALIDATIONTYPE_REMOVED
public static final int INVALIDATIONTYPE_REMOVED- See Also:
-
INVALIDATIONTYPE_CREATED
public static final int INVALIDATIONTYPE_CREATED- See Also:
-
INVALIDATIONTYPE_MODIFIED_STRING
-
INVALIDATIONTYPE_REMOVED_STRING
-
UNKNOWN
-
cacheKey
-
-
Constructor Details
-
AbstractCacheUnit
-
AbstractCacheUnit
For testing -
AbstractCacheUnit
-
-
Method Details
-
createKey
-
getKey
-
getLoader
-
load
We do not perform compute not to hit database several times from different threads.
Another reason is to keep lifecycle of hooks in the same order. addedToCacheBeforeComputation() is called here other callbacks in the RegionCacheAdapter.- Specified by:
loadin interfaceCacheValueLoader- Throws:
CacheValueLoadException
-
compute
- Throws:
Exception
-
getCache
-
isValueKnown
public boolean isValueKnown() -
isCachingSupported
public boolean isCachingSupported() -
getTenantID
-
getKeyAsArray
-
useCache
protected boolean useCache() -
get
- Throws:
Exception
-
getWithoutCompute
-
getWithoutComputeIgnoringTransaction
-
getInvalidationTopicDepth
public int getInvalidationTopicDepth()Returns the number of elements of the key that are elements of the invalidation topic key. This method must be implemented for all AbstractCacheUnits that are invalidated externally. -
hintValue
This method allows direct setting of the value (without execution ofcompute()); it can be used if the value is available as result of some other operation; callers guarantee that the given value is equal to the Object that would be returned by a call to compute The new value will only be set if the object is not already in the cache. -
invalidate
public void invalidate(int invalidationType) mark the Cache Unit to be invalidated upon commit invalidationType is one of the constants (modified or remove) -
removedFromCache
public void removedFromCache() -
addedToCacheBeforeComputation
public void addedToCacheBeforeComputation() -
executeInvalidation
public void executeInvalidation() -
hashCode
public final int hashCode() -
equals
-
toString
-