Class BaseStorageCache
java.lang.Object
ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.BaseStorageCache
- All Implemented Interfaces:
StorageCache
- Direct Known Subclasses:
InstrumentedStorageCache,ThreadLocalDocumentCache
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.StorageCache
StorageCache.CacheContext, StorageCache.LoadFromStorageStrategy -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidcacheDocuments(QueryResult queryResult) protected abstract StorageCache.CacheContextcreateCacheContext(Storage storage, BaseStorageCache.CacheFlushAction flushAction) protected abstract Optional<QueryResult>findInCache(Query query) Method to find a query result in cache.findInCache(Query query, StorageCache.LoadFromStorageStrategy targetFunction) protected abstract QueryResultfindInStorage(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction) protected abstract BaseStorageCache.CacheFlushActioninitCacheContext(Storage storage) protected abstract booleanisFindInStorageFirst(Query query) Method to verify whether a query should be called to the storage firstMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.StorageCache
isCacheActive, remove, save
-
Constructor Details
-
BaseStorageCache
public BaseStorageCache()
-
-
Method Details
-
findInCache
- Specified by:
findInCachein interfaceStorageCache
-
isFindInStorageFirst
Method to verify whether a query should be called to the storage first- Parameters:
query- the query used to find documents- Returns:
trueif query should be called to the storage first
-
cacheDocuments
-
findInStorage
protected abstract QueryResult findInStorage(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction) -
findInCache
Method to find a query result in cache. Is called only if returnstrue- Parameters:
query- the query used to find documents- Returns:
Optional.empty()if no documents has been found in cache that meets the query, otherwise an optional of
-
initCacheContext
- Specified by:
initCacheContextin interfaceStorageCache
-
getFlushAction
-
createCacheContext
protected abstract StorageCache.CacheContext createCacheContext(Storage storage, BaseStorageCache.CacheFlushAction flushAction)
-