Interface SynchronizationCacheService
-
- All Known Implementing Classes:
DefaultSynchronizationCacheService
public interface SynchronizationCacheServiceCache service used to cache elements during synchronization process.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T> TgetOrSetItemCache(java.util.function.Supplier<T> supplier, java.lang.String cacheKey)Retrieves the item from the cache.<T> java.util.List<T>getOrSetItemListCache(java.util.function.Supplier<java.util.List<T>> supplier, java.lang.String cacheKey)Retrieves the list of items from the cache.<T> java.util.List<T>getOrSetItemListCache(java.util.function.Supplier<java.util.List<T>> supplier, java.lang.String cachePrefix, ItemModel... itemsForKeys)Retrieves the list of items from the cache.default voidinitCache()Initialize the cache, it creates cache objects in current session.
-
-
-
Method Detail
-
initCache
default void initCache()
Initialize the cache, it creates cache objects in current session.
-
getOrSetItemListCache
<T> java.util.List<T> getOrSetItemListCache(java.util.function.Supplier<java.util.List<T>> supplier, java.lang.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
<T> java.util.List<T> getOrSetItemListCache(java.util.function.Supplier<java.util.List<T>> supplier, java.lang.String cacheKey)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
<T> T getOrSetItemCache(java.util.function.Supplier<T> supplier, java.lang.String cacheKey)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
-
-