Interface EntityCache
-
- All Superinterfaces:
Session
- All Known Implementing Classes:
EntityCacheImpl
public interface EntityCache extends Session
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
cacheRemove(java.lang.Class<?> entityClass, java.lang.String entityId)
Removes theEntity
of the given type with the given id from the cache.<T> java.util.List<T>
findInCache(java.lang.Class<T> entityClass)
Returns all cachedEntity
instances of a given type.<T> T
findInCache(java.lang.Class<T> entityClass, java.lang.String id)
Returns the cachedEntity
instance of the given class with the provided id.<T> java.util.Collection<CachedEntity>
findInCacheAsCachedObjects(java.lang.Class<T> entityClass)
Returns allCachedEntity
instances for the given type.java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>>
getAllCachedEntities()
Returns all cachedEntity
instances as a map with following structure: { entityClassName, {entityId, entity} }CachedEntity
put(Entity entity, boolean storeState)
Adds the givesEntity
to the cache.
-
-
-
Method Detail
-
getAllCachedEntities
java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>> getAllCachedEntities()
Returns all cachedEntity
instances as a map with following structure: { entityClassName, {entityId, entity} }
-
put
CachedEntity put(Entity entity, boolean storeState)
Adds the givesEntity
to the cache.- Parameters:
entity
- TheEntity
instancestoreState
- If true, the current stateEntity.getPersistentState()
will be stored for future diffing. Note that, if false, theEntity
will always be seen as changed.- Returns:
- Returns a
CachedEntity
instance, which can be enriched later on.
-
findInCache
<T> T findInCache(java.lang.Class<T> entityClass, java.lang.String id)
-
findInCache
<T> java.util.List<T> findInCache(java.lang.Class<T> entityClass)
Returns all cachedEntity
instances of a given type. Returns an empty list if no instances of the given type exist.
-
findInCacheAsCachedObjects
<T> java.util.Collection<CachedEntity> findInCacheAsCachedObjects(java.lang.Class<T> entityClass)
Returns allCachedEntity
instances for the given type. The difference withfindInCache(Class)
is that here the wholeCachedEntity
is returned, which gives access to the persistent state at the moment of putting it in the cache.
-
cacheRemove
void cacheRemove(java.lang.Class<?> entityClass, java.lang.String entityId)
Removes theEntity
of the given type with the given id from the cache.
-
-