public interface CachedRepository<TKey,T extends ObjectWithId<TKey>,C extends CacheService<TKey,T,TDataStore>,TDataStore> extends Repository<TKey,T,TDataStore>
| Modifier and Type | Method and Description |
|---|---|
<K> java.util.concurrent.CompletableFuture<K> |
applyFromDBThroughCache(java.util.function.Supplier<K> fromDB,
java.util.function.BiFunction<C,K,K> cacheTransformer)
Usually used for editing model data
|
<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> |
applyFromDBThroughCacheConditionally(java.util.function.Supplier<java.util.Optional<K>> fromDB,
java.util.function.BiFunction<C,K,java.util.Optional<K>> cacheTransformer)
Usually used for editing model data
|
<K> java.util.concurrent.CompletableFuture<K> |
applyFromDBToCache(java.util.function.Supplier<K> fromDB,
java.util.function.BiConsumer<C,K> toCache)
Usually used when (updated) data from DB needs to be applied to cache
|
<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> |
applyFromDBToCacheConditionally(java.util.function.Supplier<java.util.Optional<K>> fromDB,
java.util.function.BiConsumer<C,K> toCache)
Usually used when (updated) data from DB needs to be applied to cache
|
<K> java.util.concurrent.CompletableFuture<K> |
applyThroughBoth(java.util.function.Function<C,K> cacheTransformer,
java.util.function.Function<java.util.Optional<K>,K> dbTransformer)
Usually used for editing model data
|
<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> |
applyThroughBothConditionally(java.util.function.Function<C,java.util.Optional<K>> cacheTransformer,
java.util.function.Function<K,K> dbTransformer)
Usually used for retrieving or editing model data
|
<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> |
applyToBothConditionally(java.util.function.Function<C,java.util.Optional<K>> cacheTransformer,
java.util.function.Supplier<java.util.Optional<K>> dbSupplier)
Usually used for retrieving or editing model data
|
default java.util.Optional<C> |
getRepositoryCacheService() |
getCreatedUtcdeleteOne, deleteOne, generateEmpty, getAll, getAllIds, getOne, getOne, getTClass, insert, insertOne, parseAndDeleteOne, parseAndGetOnegetDataStoreContext, getTKeyClass, parse, parseUnsafedefault java.util.Optional<C> getRepositoryCacheService()
<K> java.util.concurrent.CompletableFuture<K> applyFromDBToCache(java.util.function.Supplier<K> fromDB,
java.util.function.BiConsumer<C,K> toCache)
Usually used when (updated) data from DB needs to be applied to cache
toCache will run if and only if:
K - The type returned from the cache and databasefromDB - Supplier retrieving data from DBtoCache - BiConsumer applying DB data to cache<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> applyFromDBToCacheConditionally(java.util.function.Supplier<java.util.Optional<K>> fromDB,
java.util.function.BiConsumer<C,K> toCache)
Usually used when (updated) data from DB needs to be applied to cache
toCache will run if and only if:
Optional result from fromDB is presentK - The type returned from the cache and databasefromDB - Supplier retrieving data from DBtoCache - BiConsumer applying DB data to cache.<K> java.util.concurrent.CompletableFuture<K> applyFromDBThroughCache(java.util.function.Supplier<K> fromDB,
java.util.function.BiFunction<C,K,K> cacheTransformer)
Usually used for editing model data
cacheTransformer will run if and only if:
K - The type returned from the cache and databasefromDB - Supplier retrieving data from DBcacheTransformer - BiFunction applying DB data to cache<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> applyFromDBThroughCacheConditionally(java.util.function.Supplier<java.util.Optional<K>> fromDB,
java.util.function.BiFunction<C,K,java.util.Optional<K>> cacheTransformer)
Usually used for editing model data
cacheTransformer will run if and only if:
Optional result from fromDB is presentK - The type returned from the cache and databasefromDB - Supplier retrieving data from DBcacheTransformer - BiFunction applying DB data to cache. Will only be run if Optional is present<K> java.util.concurrent.CompletableFuture<K> applyThroughBoth(java.util.function.Function<C,K> cacheTransformer, java.util.function.Function<java.util.Optional<K>,K> dbTransformer)
Usually used for editing model data
cacheTransformer will run if and only if:
K - The type returned by the cache and databasecacheTransformer - Function applying transformation to data in cache and returning new datadbTransformer - Function retrieving data from db.
Optional is the result of the cache function (will be empty if the cache or the result is not present)<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> applyThroughBothConditionally(java.util.function.Function<C,java.util.Optional<K>> cacheTransformer, java.util.function.Function<K,K> dbTransformer)
Usually used for retrieving or editing model data
cacheTransformer will run if and only if:
dbTransformer will run if and only if:
Optional result from cacheTransformer is presentK - The type returned by the cache and databasecacheTransformer - Function applying transformation to data in cache and returning new datadbTransformer - Function applying transformation to data in dbK result from cache<K> java.util.concurrent.CompletableFuture<java.util.Optional<K>> applyToBothConditionally(java.util.function.Function<C,java.util.Optional<K>> cacheTransformer, java.util.function.Supplier<java.util.Optional<K>> dbSupplier)
Usually used for retrieving or editing model data
cacheTransformer will run if and only if:
dbTransformer will run if and only if:
Optional result from cacheTransformer is not presentK - The type returned by the cache and databasecacheTransformer - Function applying transformation to data in cache and returning new datadbSupplier - Supplier retrieving data from db. Will only be run if Optional is not presentK result from cache if present, otherwise from db