public abstract class AbstractCacheUnit extends Object implements CacheValueLoader
| Modifier and Type | Field and Description |
|---|---|
protected CacheKey |
cacheKey |
static int |
INVALIDATIONTYPE_CREATED |
static int |
INVALIDATIONTYPE_MODIFIED |
static String |
INVALIDATIONTYPE_MODIFIED_STRING |
static int |
INVALIDATIONTYPE_REMOVED |
static String |
INVALIDATIONTYPE_REMOVED_STRING |
static Object |
UNKNOWN |
| Constructor and Description |
|---|
AbstractCacheUnit(Cache cache) |
AbstractCacheUnit(Cache cache,
String tenantId)
For testing
|
AbstractCacheUnit(Cache cache,
Tenant tenant) |
| Modifier and Type | Method and Description |
|---|---|
void |
addedToCacheBeforeComputation() |
static boolean |
arrayDeepEqualsReverse(Object[] objectArray1,
Object[] objectArray2)
Deprecated.
since 5.0.1
|
abstract Object |
compute() |
abstract Object[] |
createKey() |
boolean |
equals(Object object) |
void |
executeInvalidation() |
Object |
get() |
protected Cache |
getCache() |
int |
getInvalidationTopicDepth()
Returns the number of elements of the key that are elements of the invalidation topic key.
|
CacheKey |
getKey() |
Object[] |
getKeyAsArray() |
CacheValueLoader<? extends AbstractCacheUnit> |
getLoader() |
String |
getTenantID() |
Object |
getWithoutCompute() |
Object |
getWithoutComputeIgnoringTransaction() |
int |
hashCode() |
protected void |
hintValue(Object newValue)
This method allows direct setting of the value (without execution of
compute()); 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. |
void |
invalidate(int invalidationType)
mark the Cache Unit to be invalidated upon commit invalidationType is one of the constants (modified or remove)
|
boolean |
isCachingSupported() |
boolean |
isValueKnown() |
boolean |
isZombie()
Deprecated.
since 5.0
|
boolean |
keepAlive()
Deprecated.
since 5.0
|
Object |
load(CacheKey key)
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. |
void |
markKeptAlive()
Deprecated.
since 5.0
|
void |
removedFromCache() |
String |
toString() |
protected boolean |
useCache() |
public static final int INVALIDATIONTYPE_MODIFIED
public static final int INVALIDATIONTYPE_REMOVED
public static final int INVALIDATIONTYPE_CREATED
public static final String INVALIDATIONTYPE_MODIFIED_STRING
public static final String INVALIDATIONTYPE_REMOVED_STRING
public static Object UNKNOWN
protected volatile CacheKey cacheKey
public AbstractCacheUnit(Cache cache)
public abstract Object[] createKey()
public CacheKey getKey()
public CacheValueLoader<? extends AbstractCacheUnit> getLoader()
public Object load(CacheKey key) throws CacheValueLoadException
load in interface CacheValueLoaderCacheValueLoadExceptionprotected Cache getCache()
public boolean isValueKnown()
public boolean isCachingSupported()
public String getTenantID()
public final Object[] getKeyAsArray()
protected boolean useCache()
public Object getWithoutCompute()
public Object getWithoutComputeIgnoringTransaction()
public int getInvalidationTopicDepth()
protected void hintValue(Object newValue)
compute()); 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.public void invalidate(int invalidationType)
@Deprecated public boolean keepAlive()
@Deprecated public boolean isZombie()
@Deprecated public void markKeptAlive()
public void removedFromCache()
public void addedToCacheBeforeComputation()
public void executeInvalidation()
@Deprecated public static boolean arrayDeepEqualsReverse(Object[] objectArray1, Object[] objectArray2)
Copyright © 2017 SAP SE. All Rights Reserved.