Package org.molgenis.data.cache.utils
Class CombinedEntityCache
- java.lang.Object
-
- org.molgenis.data.cache.utils.CombinedEntityCache
-
-
Constructor Summary
Constructors Constructor Description CombinedEntityCache(EntityHydration entityHydration, com.google.common.cache.Cache<org.molgenis.data.EntityKey,CacheHit<Map<String,Object>>> cache)Creates a newCombinedEntityCache
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidevict(Stream<org.molgenis.data.EntityKey> entityKeys)voidevictAll(org.molgenis.data.meta.model.EntityType entityType)Evicts all entries from the cache that belong to a certain entityType.Optional<CacheHit<org.molgenis.data.Entity>>getIfPresent(org.molgenis.data.meta.model.EntityType entityType, Object id)Retrieves an entity from the cache if present.voidput(org.molgenis.data.Entity entity)Inserts an entity into the cache.voidputDeletion(org.molgenis.data.EntityKey entityKey)Caches the deletion of an entity instance.
-
-
-
Constructor Detail
-
CombinedEntityCache
public CombinedEntityCache(EntityHydration entityHydration, com.google.common.cache.Cache<org.molgenis.data.EntityKey,CacheHit<Map<String,Object>>> cache)
Creates a newCombinedEntityCache- Parameters:
entityHydration-EntityHydrationused to hydrate and dehydrate the entities and generate cache keyscache- theCacheto store theCacheHits in
-
-
Method Detail
-
putDeletion
public void putDeletion(org.molgenis.data.EntityKey entityKey)
Caches the deletion of an entity instance.- Parameters:
entityKey- theEntityKeyof the deleted entity instance
-
evictAll
public void evictAll(org.molgenis.data.meta.model.EntityType entityType)
Evicts all entries from the cache that belong to a certain entityType.- Parameters:
entityType- the id of the entity whose entries are to be evicted
-
getIfPresent
public Optional<CacheHit<org.molgenis.data.Entity>> getIfPresent(org.molgenis.data.meta.model.EntityType entityType, Object id)
Retrieves an entity from the cache if present.- Parameters:
entityType- EntityType of the entity to retrieveid- id value of the entity to retrieve- Returns:
- Optional
CacheHitwith the result from the cache, empty if no record of the entity is present in the cache
-
put
public void put(org.molgenis.data.Entity entity)
Inserts an entity into the cache.- Parameters:
entity- the entity to insert into the cache
-
evict
public void evict(Stream<org.molgenis.data.EntityKey> entityKeys)
-
-