Package org.fuin.ddd4j.ddd
Interface AggregateCache<AGGREGATE>
-
- 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AGGREGATEget(@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 Detail
-
get
AGGREGATE get(@NotNull @NotNull AggregateRootId aggregateId, Integer version)
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
void put(@NotNull @NotNull AggregateRootId aggregateId, @NotNull AGGREGATE aggregate)Puts an aggregate with the given identifier in the cache.- Parameters:
aggregateId- Aggregate to load.aggregate- Aggregate to cache.
-
remove
void remove(@NotNull @NotNull AggregateRootId aggregateId)Removes the aggregate with the given identifier from the cache.- Parameters:
aggregateId- Aggregate to remove from cache.
-
-