Interface SynchronizationCacheService
- All Known Implementing Classes:
DefaultSynchronizationCacheService
public interface SynchronizationCacheService
Cache service used to cache elements during synchronization process.
-
Method Summary
Modifier and TypeMethodDescription<T> TgetOrSetItemCache(Supplier<T> supplier, String cacheKey) Retrieves the item from the cache.<T> List<T>getOrSetItemListCache(Supplier<List<T>> supplier, String cacheKey) Retrieves the list of items from the cache.<T> List<T>getOrSetItemListCache(Supplier<List<T>> supplier, String cachePrefix, ItemModel... itemsForKeys) Retrieves the list of items from the cache.default voidInitialize the cache, it creates cache objects in current session.
-
Method Details
-
initCache
default void initCache()Initialize the cache, it creates cache objects in current session. -
getOrSetItemListCache
<T> List<T> getOrSetItemListCache(Supplier<List<T>> supplier, String cachePrefix, ItemModel... itemsForKeys) Retrieves the list of items from the cache. If cache does not contain any items the supplier is called to populate the cache and return the value.- Type Parameters:
T- the type T represents any java type.- Parameters:
supplier- the supplier to execute if items does not exist in cache.cachePrefix- the cache prefix (is concatenated with the cache key generated based on itemsForKeys)itemsForKeys- the list of items that are used to generate a cache key.- Returns:
- the list of items.
-
getOrSetItemListCache
Retrieves the list of items from the cache. If cache does not contain any items the supplier is called to populate the cache and return the value.- Type Parameters:
T- the type T represents any java type.- Parameters:
supplier- the supplier to execute if items does not exist in cache.cacheKey- the cache key- Returns:
- the list of items.
-
getOrSetItemCache
Retrieves the item from the cache. If cache does not contain an item the supplier is called to populate the cache and return the value.- Parameters:
supplier- the supplier to execute if item does not exist in cache.cacheKey- the cache key- Returns:
- the item
-