Class NoStateRebuildingCache
java.lang.Object
com.opencqrs.framework.command.cache.NoStateRebuildingCache
- All Implemented Interfaces:
StateRebuildingCache
StateRebuildingCache
implementation that does not cache anything.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.opencqrs.framework.command.cache.StateRebuildingCache
StateRebuildingCache.CacheKey<I>, StateRebuildingCache.CacheValue<I>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfetchAndMerge
(StateRebuildingCache.CacheKey<I> key, Function<StateRebuildingCache.CacheValue<I>, StateRebuildingCache.CacheValue<I>> mergeFunction) Method supposed to fetch aStateRebuildingCache.CacheValue
from the underlying cache based on the givenStateRebuildingCache.CacheKey
.
-
Constructor Details
-
NoStateRebuildingCache
public NoStateRebuildingCache()
-
-
Method Details
-
fetchAndMerge
public <I> StateRebuildingCache.CacheValue<I> fetchAndMerge(StateRebuildingCache.CacheKey<I> key, Function<StateRebuildingCache.CacheValue<I>, StateRebuildingCache.CacheValue<I>> mergeFunction) Description copied from interface:StateRebuildingCache
Method supposed to fetch aStateRebuildingCache.CacheValue
from the underlying cache based on the givenStateRebuildingCache.CacheKey
. The cached value is applied to the givenmergeFunction
, the underlying cache updated with the mergedStateRebuildingCache.CacheValue
, before it is returned to the caller. Implementations may choose to return an even newerStateRebuildingCache.CacheValue
, if concurrent merges occur.- Specified by:
fetchAndMerge
in interfaceStateRebuildingCache
- Type Parameters:
I
- the generic instance type being cached- Parameters:
key
- the cache keymergeFunction
- a merge function updating aStateRebuildingCache.CacheValue
previously cached, typically by fetching newer events, applying them to the instance and returning the merged value, which will then be applied to the underlying cache (if no newer value has already been applied concurrently, depending on the concurrency guarantees of the implementation). In case of a cache miss, aStateRebuildingCache.CacheValue
withnull
contents will be passed to the merge function, as annotated.- Returns:
- the fetched and merged cache value
-