Package org.molgenis.data.cache.l2
Class L2CacheRepositoryDecorator
- java.lang.Object
-
- com.google.common.collect.ForwardingObject
-
- org.molgenis.data.AbstractRepositoryDecorator<org.molgenis.data.Entity>
-
- org.molgenis.data.cache.l2.L2CacheRepositoryDecorator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Iterable<org.molgenis.data.Entity>,org.molgenis.data.Repository<org.molgenis.data.Entity>
public class L2CacheRepositoryDecorator extends org.molgenis.data.AbstractRepositoryDecorator<org.molgenis.data.Entity>Adds, removes and retrieves entities from theL2Cachewhen aRepositoryisRepositoryCapability.CACHEABLE.Delegates to the underlying repository when an action is not supported by the cache or when the cache doesn't contain the needed entity.
-
-
Constructor Summary
Constructors Constructor Description L2CacheRepositoryDecorator(org.molgenis.data.Repository<org.molgenis.data.Entity> delegateRepository, L2Cache l2Cache, org.molgenis.data.transaction.TransactionInformation transactionInformation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stream<org.molgenis.data.Entity>findAll(Stream<Object> ids)Retrieves multiple entities by id.Stream<org.molgenis.data.Entity>findAll(Stream<Object> ids, org.molgenis.data.Fetch fetch)org.molgenis.data.EntityfindOneById(Object id)Retrieves a single entity by id.org.molgenis.data.EntityfindOneById(Object id, org.molgenis.data.Fetch fetch)-
Methods inherited from class org.molgenis.data.AbstractRepositoryDecorator
add, add, aggregate, close, count, count, delegate, delete, delete, deleteAll, deleteAll, deleteById, findAll, findOne, forEachBatched, getCapabilities, getEntityType, getName, getQueryOperators, iterator, query, update, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
L2CacheRepositoryDecorator
public L2CacheRepositoryDecorator(org.molgenis.data.Repository<org.molgenis.data.Entity> delegateRepository, L2Cache l2Cache, org.molgenis.data.transaction.TransactionInformation transactionInformation)
-
-
Method Detail
-
findOneById
public org.molgenis.data.Entity findOneById(Object id)
Retrieves a single entity by id.- Specified by:
findOneByIdin interfaceorg.molgenis.data.Repository<org.molgenis.data.Entity>- Overrides:
findOneByIdin classorg.molgenis.data.AbstractRepositoryDecorator<org.molgenis.data.Entity>- Parameters:
id- the entity's ID value- Returns:
- the retrieved Entity, or null if not present.
-
findAll
public Stream<org.molgenis.data.Entity> findAll(Stream<Object> ids)
Retrieves multiple entities by id.If the repository is cacheable and the current transaction hasn't completely dirtied it, will split the stream into batches and load the batches through
findAllBatch(List).Otherwise, will delegate this call to the decorated repository.
-
findAll
public Stream<org.molgenis.data.Entity> findAll(Stream<Object> ids, org.molgenis.data.Fetch fetch)
- Specified by:
findAllin interfaceorg.molgenis.data.Repository<org.molgenis.data.Entity>- Overrides:
findAllin classorg.molgenis.data.AbstractRepositoryDecorator<org.molgenis.data.Entity>
-
findOneById
public org.molgenis.data.Entity findOneById(Object id, org.molgenis.data.Fetch fetch)
- Specified by:
findOneByIdin interfaceorg.molgenis.data.Repository<org.molgenis.data.Entity>- Overrides:
findOneByIdin classorg.molgenis.data.AbstractRepositoryDecorator<org.molgenis.data.Entity>
-
-