org.enodeframework.domain.MemoryCache.kt Maven / Gradle / Ivy
package org.enodeframework.domain
import java.util.concurrent.CompletableFuture
interface MemoryCache {
/**
* Get a strong type aggregate from memory cache.
*/
fun getAsync(aggregateRootId: String, aggregateRootType: Class): CompletableFuture
/**
* Accept the given aggregate root's changes.
*/
fun acceptAggregateRootChanges(aggregateRoot: T)
/**
* Refresh the given aggregate.
*/
fun refreshAggregate(aggregateRoot: T)
/**
* Refresh the aggregate memory cache by replaying events of event store, and return the refreshed aggregate root.
*/
fun refreshAggregateFromEventStoreAsync(
aggregateRootTypeName: String, aggregateRootId: String
): CompletableFuture
/**
* Refresh the aggregate memory cache by replaying events of event store, and return the refreshed aggregate root.
*/
fun refreshAggregateFromEventStoreAsync(
aggregateRootType: Class, aggregateRootId: String
): CompletableFuture
/**
* Start background tasks.
*/
fun start()
/**
* Stop background tasks.
*/
fun stop()
}