public class CdmTransientEntityCacher extends java.lang.Object implements ICdmCacher
addNewEntity(CdmBase)
and there id is updated as soon as a transient object with same
uuid is added to the cacher.
This cache guarantees that
- all objects put will be ancestors of CdmBase
- all CdmBase objects in the cache will be already de-proxied
- after any CdmBase object is put in the cache,
all non-null / non-proxy CdmBase objects in the sub-graph
will also be present in the cache.Constructor and Description |
---|
CdmTransientEntityCacher(java.lang.Object sessionOwner) |
CdmTransientEntityCacher(java.lang.String cacheId) |
Modifier and Type | Method and Description |
---|---|
void |
addNewEntity(CdmBase newEntity) |
void |
clear() |
protected net.sf.ehcache.CacheManager |
createCacheManager() |
void |
dispose() |
boolean |
exists(CdmBase cdmBase) |
boolean |
exists(CdmEntityCacheKey<?> key) |
boolean |
existsAndIsNotNull(CdmEntityCacheKey<?> id) |
static java.lang.String |
generateCacheId(java.lang.Object sessionOwner) |
static <T extends CdmBase> |
generateKey(java.lang.Class<T> clazz,
int id) |
static <T extends CdmBase> |
generateKey(T cdmBase) |
java.util.List<CdmBase> |
getAllEntities() |
net.sf.ehcache.statistics.LiveCacheStatistics |
getCacheStatistics() |
CdmBase |
getFromCache(CdmBase cdmBase,
java.lang.Class<? extends CdmBase> clazz) |
<T extends CdmBase> |
getFromCache(CdmEntityCacheKey<T> id) |
<T extends CdmBase> |
getFromCache(java.lang.Class<T> clazz,
int id) |
<T extends CdmBase> |
getFromCache(T cdmBase)
Retrieves the cached version of the passed entity from the cache if it
exists in there.
|
CdmModelFieldPropertyFromClass |
getFromCdmlibModelCache(java.lang.String className) |
boolean |
isCachable(CdmBase cdmEntity) |
<T> java.util.Collection<T> |
load(java.util.Collection<T> collection,
boolean update) |
<T> java.util.Map<T,T> |
load(java.util.Map<T,T> map,
boolean update) |
MergeResult<CdmBase> |
load(MergeResult<CdmBase> mergeResult,
boolean update) |
<T extends CdmBase> |
load(T cdmEntity)
Load into the cache and return the entity from the cache.
|
<T> T |
load(T obj,
boolean update) |
<T extends CdmBase> |
load(T cdmEntity,
boolean update)
Loads the
cdmEntity ) graph recursively into the
cache. |
void |
put(CdmBase cdmEntity)
Puts the passed
cdmEntity into the cache as long it does
not yet exist in the caches. |
protected void |
putToCache(CdmEntityCacheKey<?> key,
CdmBase cdmEntityToCache) |
static void |
setPermanentCacher(CdmCacher permanentCacher) |
public CdmTransientEntityCacher(java.lang.String cacheId)
public CdmTransientEntityCacher(java.lang.Object sessionOwner)
public static java.lang.String generateCacheId(java.lang.Object sessionOwner)
public static void setPermanentCacher(CdmCacher permanentCacher)
public net.sf.ehcache.statistics.LiveCacheStatistics getCacheStatistics()
protected net.sf.ehcache.CacheManager createCacheManager()
public <T> T load(T obj, boolean update)
public <T> java.util.Map<T,T> load(java.util.Map<T,T> map, boolean update)
public <T> java.util.Collection<T> load(java.util.Collection<T> collection, boolean update)
public <T extends CdmBase> T load(T cdmEntity, boolean update)
cdmEntity
) graph recursively into the
cache.
For in depth details on the whole mechanism see
CacheLoader.load(CdmBase, boolean, boolean)
,
CacheLoader.loadRecursive(CdmBase, List, boolean)
and
CacheLoader.getCdmBaseTypeFieldValue(CdmBase, CdmBase, String, List, boolean)
cdmEntity
- the entity to be put into the cacheupdate
- all fields of the cached entity will be overwritten by setting
them to the value of the cdm entity being loadedpublic MergeResult<CdmBase> load(MergeResult<CdmBase> mergeResult, boolean update)
public CdmModelFieldPropertyFromClass getFromCdmlibModelCache(java.lang.String className)
public void addNewEntity(CdmBase newEntity)
public void put(CdmBase cdmEntity)
cdmEntity
into the cache as long it does
not yet exist in the caches.
The adjacent ENTITY GRAPH WILL NOT BE LOADED RECURSIVELY
put
in interface ICdmCacher
protected void putToCache(CdmEntityCacheKey<?> key, CdmBase cdmEntityToCache)
key
- cdmEntityToCache
- public <T extends CdmBase> T getFromCache(CdmEntityCacheKey<T> id)
public <T extends CdmBase> T getFromCache(java.lang.Class<T> clazz, int id)
public <T extends CdmBase> T getFromCache(T cdmBase)
ICdmCacher
getFromCache
in interface ICdmCacher
cdmBase
- the cdm entity to find in the cachenull
public java.util.List<CdmBase> getAllEntities()
public boolean exists(CdmEntityCacheKey<?> key)
public boolean existsAndIsNotNull(CdmEntityCacheKey<?> id)
public void clear()
public void dispose()
dispose
in interface ICdmCacher
public static <T extends CdmBase> CdmEntityCacheKey<T> generateKey(java.lang.Class<T> clazz, int id)
public static <T extends CdmBase> CdmEntityCacheKey<T> generateKey(T cdmBase)
public <T extends CdmBase> T load(T cdmEntity)
ICdmCacher
cdmEntity
passed to this method.load
in interface ICdmCacher
public boolean isCachable(CdmBase cdmEntity)
isCachable
in interface ICdmCacher
cdmEntity
is cacheable by the
implementationpublic boolean exists(CdmBase cdmBase)
exists
in interface ICdmCacher
cdmEntity
is found in the cacheCopyright © 2007-2020 EDIT. All Rights Reserved.