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 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 or null for latest.
        Returns:
        Cached aggregate or null if 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.