Class CombinedEntityCache


  • public class CombinedEntityCache
    extends java.lang.Object
    Caches CacheHits with Entitys from different repositories in dehydrated form in a single combined Guava Cache.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void evict​(java.util.stream.Stream<org.molgenis.data.EntityKey> entityKeys)  
      void evictAll​(org.molgenis.data.meta.model.EntityType entityType)
      Evicts all entries from the cache that belong to a certain entityType.
      java.util.Optional<CacheHit<org.molgenis.data.Entity>> getIfPresent​(org.molgenis.data.meta.model.EntityType entityType, java.lang.Object id)
      Retrieves an entity from the cache if present.
      void put​(org.molgenis.data.Entity entity)
      Inserts an entity into the cache.
      void putDeletion​(org.molgenis.data.EntityKey entityKey)
      Caches the deletion of an entity instance.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CombinedEntityCache

        public CombinedEntityCache​(EntityHydration entityHydration,
                                   com.google.common.cache.Cache<org.molgenis.data.EntityKey,​CacheHit<java.util.Map<java.lang.String,​java.lang.Object>>> cache)
        Creates a new CombinedEntityCache
        Parameters:
        entityHydration - EntityHydration used to hydrate and dehydrate the entities and generate cache keys
        cache - the Cache to store the CacheHits in
    • Method Detail

      • putDeletion

        public void putDeletion​(org.molgenis.data.EntityKey entityKey)
        Caches the deletion of an entity instance.
        Parameters:
        entityKey - the EntityKey of 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 java.util.Optional<CacheHit<org.molgenis.data.Entity>> getIfPresent​(org.molgenis.data.meta.model.EntityType entityType,
                                                                                   java.lang.Object id)
        Retrieves an entity from the cache if present.
        Parameters:
        entityType - EntityType of the entity to retrieve
        id - id value of the entity to retrieve
        Returns:
        Optional CacheHit with 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​(java.util.stream.Stream<org.molgenis.data.EntityKey> entityKeys)