@Test void evictAll() { String entityTypeId = "MyEntityTypeId"; EntityType entityType = when(mock(EntityType.class).getId()).thenReturn(entityTypeId).getMock(); Object entityId = mock(Object.class); Entity entity = when(mock(Entity.class).getIdValue()).thenReturn(entityId).getMock(); when(entity.getEntityType()).thenReturn(entityType); l1Cache.putDeletion(entity); l1Cache.evictAll(entityType); assertEquals(Optional.empty(), l1Cache.get(entityType, entityId)); }
void evictAll(EntityType entityType) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); entityCache.evictAll(entityType); } }
L1Cache implements TransactionListener { void evictAll(EntityType entityType) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); entityCache.evictAll(entityType); } } }
L1Cache implements TransactionListener { void evictAll(EntityType entityType) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); entityCache.evictAll(entityType); } } L1Cache(TransactionManager transactionManager, EntityHydration entityHydration); }
L1Cache implements TransactionListener { void evictAll(EntityType entityType) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); entityCache.evictAll(entityType); } } L1Cache(TransactionManager transactionManager, EntityHydration entityHydration); @Override void transactionStarted(String transactionId); @Override void doCleanupAfterCompletion(String transactionId); Optional<CacheHit<Entity>> get(EntityType entityType, Object entityId); Optional<CacheHit<Entity>> get(
      EntityType entityType, Object entityId, @Nullable @CheckForNull Fetch fetch); void put(Entity entity); }
L1Cache implements TransactionListener { void evictAll(EntityType entityType) { CombinedEntityCache entityCache = caches.get(); if (entityCache != null) { LOG.trace("Removing all entities from L1 cache that belong to {}", entityType.getId()); entityCache.evictAll(entityType); } } L1Cache(TransactionManager transactionManager, EntityHydration entityHydration); @Override void transactionStarted(String transactionId); @Override void doCleanupAfterCompletion(String transactionId); Optional<CacheHit<Entity>> get(EntityType entityType, Object entityId); Optional<CacheHit<Entity>> get(
      EntityType entityType, Object entityId, @Nullable @CheckForNull Fetch fetch); void put(Entity entity);  }