- Type Parameters:
AGGREGATE- Type of the aggregate.
- All Known Implementing Classes:
AggregateNoCache
public interface AggregateCache<AGGREGATE>
Cache for aggregates of the same type.
-
Method Summary
Modifier and TypeMethodDescriptionget(@NotNull AggregateRootId aggregateId, Integer version) Tries to read the aggregate with the given identifier from the cache.voidput(@NotNull AggregateRootId aggregateId, AGGREGATE aggregate) Puts an aggregate with the given identifier in the cache.voidremove(@NotNull AggregateRootId aggregateId) Removes the aggregate with the given identifier from the cache.
-
Method Details
-
get
Tries to read the aggregate with the given identifier from the cache.- Parameters:
aggregateId- Aggregate to load.version- Version to load ornullfor latest.- Returns:
- Cached aggregate or
nullif it was not found in the cache.
-
put
Puts an aggregate with the given identifier in the cache.- Parameters:
aggregateId- Aggregate to load.aggregate- Aggregate to cache.
-
remove
Removes the aggregate with the given identifier from the cache.- Parameters:
aggregateId- Aggregate to remove from cache.
-