Class BaseStorageCache
- java.lang.Object
-
- ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.BaseStorageCache
-
- All Implemented Interfaces:
StorageCache
- Direct Known Subclasses:
InstrumentedStorageCache,ThreadLocalDocumentCache
public abstract class BaseStorageCache extends java.lang.Object implements StorageCache
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceBaseStorageCache.CacheFlushAction-
Nested classes/interfaces inherited from interface ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.StorageCache
StorageCache.CacheContext, StorageCache.LoadFromStorageStrategy
-
-
Constructor Summary
Constructors Constructor Description BaseStorageCache()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcacheDocuments(QueryResult queryResult)protected abstract StorageCache.CacheContextcreateCacheContext(Storage storage, BaseStorageCache.CacheFlushAction flushAction)protected abstract java.util.Optional<QueryResult>findInCache(Query query)Method to find a query result in cache.QueryResultfindInCache(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction)protected abstract QueryResultfindInStorage(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction)protected abstract BaseStorageCache.CacheFlushActiongetFlushAction()StorageCache.CacheContextinitCacheContext(Storage storage)protected abstract booleanisCacheActive()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ydocumentcartpackage.persistence.polyglot.repository.documentcart.storage.cache.StorageCache
remove, save
-
-
-
-
Method Detail
-
findInCache
public QueryResult findInCache(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction)
- Specified by:
findInCachein interfaceStorageCache
-
cacheDocuments
protected abstract void cacheDocuments(QueryResult queryResult)
-
isCacheActive
protected abstract boolean isCacheActive()
-
findInStorage
protected abstract QueryResult findInStorage(Query baseQuery, StorageCache.LoadFromStorageStrategy targetFunction)
-
findInCache
protected abstract java.util.Optional<QueryResult> findInCache(Query query)
Method to find a query result in cache. Is called only if {@see #isCacheActive} 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 {@see QueryResult}
-
initCacheContext
public StorageCache.CacheContext initCacheContext(Storage storage)
- Specified by:
initCacheContextin interfaceStorageCache
-
getFlushAction
protected abstract BaseStorageCache.CacheFlushAction getFlushAction()
-
createCacheContext
protected abstract StorageCache.CacheContext createCacheContext(Storage storage, BaseStorageCache.CacheFlushAction flushAction)
-
-