Package dev.morphia.mapping.cache
Class DefaultEntityCache
- java.lang.Object
-
- dev.morphia.mapping.cache.DefaultEntityCache
-
- All Implemented Interfaces:
EntityCache
public class DefaultEntityCache extends java.lang.Object implements EntityCache
This is the default EntityCache for Morphia
-
-
Constructor Summary
Constructors Constructor Description DefaultEntityCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
exists(Key<?> k)
Looks for a Key in the cachevoid
flush()
Clears the cache<T> T
getEntity(Key<T> k)
Returns the entity for a Key<T> T
getProxy(Key<T> k)
Returns a proxy for the entity for a Keyvoid
notifyExists(Key<?> k, boolean exists)
Notifies the cache of the existence of a Key<T> void
putEntity(Key<T> k, T t)
Adds an entity to the cache<T> void
putProxy(Key<T> k, T t)
Adds a proxy to the cacheEntityCacheStatistics
stats()
-
-
-
Method Detail
-
exists
public java.lang.Boolean exists(Key<?> k)
Description copied from interface:EntityCache
Looks for a Key in the cache- Specified by:
exists
in interfaceEntityCache
- Parameters:
k
- the Key to search for- Returns:
- true if the Key is found
-
flush
public void flush()
Description copied from interface:EntityCache
Clears the cache- Specified by:
flush
in interfaceEntityCache
-
getEntity
public <T> T getEntity(Key<T> k)
Description copied from interface:EntityCache
Returns the entity for a Key- Specified by:
getEntity
in interfaceEntityCache
- Type Parameters:
T
- the type of the entity- Parameters:
k
- the Key to search for- Returns:
- the entity
-
getProxy
public <T> T getProxy(Key<T> k)
Description copied from interface:EntityCache
Returns a proxy for the entity for a Key- Specified by:
getProxy
in interfaceEntityCache
- Type Parameters:
T
- the type of the entity- Parameters:
k
- the Key to search for- Returns:
- the proxy
-
notifyExists
public void notifyExists(Key<?> k, boolean exists)
Description copied from interface:EntityCache
Notifies the cache of the existence of a Key- Specified by:
notifyExists
in interfaceEntityCache
- Parameters:
k
- the Keyexists
- true if the Key represents an existing entity
-
putEntity
public <T> void putEntity(Key<T> k, T t)
Description copied from interface:EntityCache
Adds an entity to the cache- Specified by:
putEntity
in interfaceEntityCache
- Type Parameters:
T
- the type of the entity- Parameters:
k
- the Key of the entityt
- the entity
-
putProxy
public <T> void putProxy(Key<T> k, T t)
Description copied from interface:EntityCache
Adds a proxy to the cache- Specified by:
putProxy
in interfaceEntityCache
- Type Parameters:
T
- the type of the entity- Parameters:
k
- the Key of the entityt
- the proxy
-
stats
public EntityCacheStatistics stats()
- Specified by:
stats
in interfaceEntityCache
- Returns:
- the stats for this cache
-
-