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.Booleanexists(Key<?> k)Looks for a Key in the cachevoidflush()Clears the cache<T> TgetEntity(Key<T> k)Returns the entity for a Key<T> TgetProxy(Key<T> k)Returns a proxy for the entity for a KeyvoidnotifyExists(Key<?> k, boolean exists)Notifies the cache of the existence of a Key<T> voidputEntity(Key<T> k, T t)Adds an entity to the cache<T> voidputProxy(Key<T> k, T t)Adds a proxy to the cacheEntityCacheStatisticsstats()
-
-
-
Method Detail
-
exists
public java.lang.Boolean exists(Key<?> k)
Description copied from interface:EntityCacheLooks for a Key in the cache- Specified by:
existsin interfaceEntityCache- Parameters:
k- the Key to search for- Returns:
- true if the Key is found
-
flush
public void flush()
Description copied from interface:EntityCacheClears the cache- Specified by:
flushin interfaceEntityCache
-
getEntity
public <T> T getEntity(Key<T> k)
Description copied from interface:EntityCacheReturns the entity for a Key- Specified by:
getEntityin 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:EntityCacheReturns a proxy for the entity for a Key- Specified by:
getProxyin 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:EntityCacheNotifies the cache of the existence of a Key- Specified by:
notifyExistsin 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:EntityCacheAdds an entity to the cache- Specified by:
putEntityin 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:EntityCacheAdds a proxy to the cache- Specified by:
putProxyin interfaceEntityCache- Type Parameters:
T- the type of the entity- Parameters:
k- the Key of the entityt- the proxy
-
stats
public EntityCacheStatistics stats()
- Specified by:
statsin interfaceEntityCache- Returns:
- the stats for this cache
-
-