public class EntityCacheImpl extends Object implements EntityCache
| Modifier and Type | Field and Description |
|---|---|
protected Map<Class<?>,Map<String,CachedEntity>> |
cachedObjects |
| Constructor and Description |
|---|
EntityCacheImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheRemove(Class<?> entityClass,
String entityId)
Removes the
Entity of the given type with the given id from the cache. |
void |
close() |
protected Map<String,CachedEntity> |
findClassCacheByCheckingSubclasses(Class<?> entityClass) |
<T> List<T> |
findInCache(Class<T> entityClass)
Returns all cached
Entity instances of a given type. |
<T> T |
findInCache(Class<T> entityClass,
String id)
Returns the cached
Entity instance of the given class with the provided id. |
<T> Collection<CachedEntity> |
findInCacheAsCachedObjects(Class<T> entityClass)
Returns all
CachedEntity instances for the given type. |
void |
flush() |
Map<Class<?>,Map<String,CachedEntity>> |
getAllCachedEntities()
Returns all cached
Entity instances as a map
with following structure: { entityClassName, {entityId, entity} } |
CachedEntity |
put(Entity entity,
boolean storeState)
Adds the gives
Entity to the cache. |
protected Map<Class<?>,Map<String,CachedEntity>> cachedObjects
public CachedEntity put(Entity entity, boolean storeState)
EntityCacheEntity to the cache.put in interface EntityCacheentity - The Entity instancestoreState - If true, the current state Entity.getPersistentState() will be stored for future diffing.public <T> T findInCache(Class<T> entityClass, String id)
EntityCacheEntity instance of the given class with the provided id.
Returns null if such a Entity cannot be found.findInCache in interface EntityCacheprotected Map<String,CachedEntity> findClassCacheByCheckingSubclasses(Class<?> entityClass)
public void cacheRemove(Class<?> entityClass, String entityId)
EntityCacheEntity of the given type with the given id from the cache.cacheRemove in interface EntityCachepublic <T> Collection<CachedEntity> findInCacheAsCachedObjects(Class<T> entityClass)
EntityCacheCachedEntity instances for the given type.
The difference with EntityCache.findInCache(Class) is that here the whole CachedEntity
is returned, which gives access to the persistent state at the moment of putting it in the cache.findInCacheAsCachedObjects in interface EntityCachepublic <T> List<T> findInCache(Class<T> entityClass)
EntityCacheEntity instances of a given type.
Returns an empty list if no instances of the given type exist.findInCache in interface EntityCachepublic Map<Class<?>,Map<String,CachedEntity>> getAllCachedEntities()
EntityCacheEntity instances as a map
with following structure: { entityClassName, {entityId, entity} }getAllCachedEntities in interface EntityCacheCopyright © 2015 Alfresco. All rights reserved.