Package org.craftercms.engine.cache
Class CacheWarmingAwareContentStoreAdapterDecorator
java.lang.Object
org.craftercms.engine.cache.CacheWarmingAwareContentStoreAdapterDecorator
- All Implemented Interfaces:
org.craftercms.core.store.ContentStoreAdapter
,ContentStoreAdapterDecorator
public class CacheWarmingAwareContentStoreAdapterDecorator
extends Object
implements ContentStoreAdapterDecorator
ContentStoreAdapterDecorator
that is aware of cache warming and uses the preloaded folders to check
if items exist before even going to the actual content store adapter, enhancing thus performance.- Since:
- 3.1.3
- Author:
- avasquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.craftercms.core.store.ContentStoreAdapter
protected org.craftercms.core.service.CacheService
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.craftercms.core.service.Context
createContext
(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) void
destroyContext
(org.craftercms.core.service.Context context) protected <T> T
executeIfNotPreloadedOrIfExistsInPreloadedPaths
(org.craftercms.engine.cache.PreloadedFoldersAwareContext contextWrapper, String path, Supplier<T> actualCall) boolean
exists
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.Content
findContent
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.Item
findItem
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path, boolean withDescriptor) List<org.craftercms.core.service.Item>
findItems
(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) protected PreloadedFolder
findPreloadedAncestor
(List<PreloadedFolder> preloadedFolders, String path) void
setActualStoreAdapter
(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Sets the store adapter to be decoratedvoid
setCacheService
(org.craftercms.core.service.CacheService cacheService) void
setWarmUpEnabled
(boolean warmUpEnabled) boolean
validate
(org.craftercms.core.service.Context context)
-
Field Details
-
warmUpEnabled
protected boolean warmUpEnabled -
actualStoreAdapter
protected org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter -
cacheService
protected org.craftercms.core.service.CacheService cacheService
-
-
Constructor Details
-
CacheWarmingAwareContentStoreAdapterDecorator
public CacheWarmingAwareContentStoreAdapterDecorator()
-
-
Method Details
-
setWarmUpEnabled
public void setWarmUpEnabled(boolean warmUpEnabled) -
setActualStoreAdapter
public void setActualStoreAdapter(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Description copied from interface:ContentStoreAdapterDecorator
Sets the store adapter to be decorated- Specified by:
setActualStoreAdapter
in interfaceContentStoreAdapterDecorator
- Parameters:
actualStoreAdapter
- the actual store adapter
-
setCacheService
public void setCacheService(org.craftercms.core.service.CacheService cacheService) -
createContext
public org.craftercms.core.service.Context createContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles) throws org.craftercms.core.exception.RootFolderNotFoundException, org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
createContext
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.RootFolderNotFoundException
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
validate
public boolean validate(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
validate
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
destroyContext
public void destroyContext(org.craftercms.core.service.Context context) throws org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException - Specified by:
destroyContext
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.StoreException
org.craftercms.core.exception.AuthenticationException
-
exists
public boolean exists(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException - Specified by:
exists
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.StoreException
-
findContent
public org.craftercms.core.service.Content findContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.StoreException - Specified by:
findContent
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.StoreException
-
findItem
public org.craftercms.core.service.Item findItem(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path, boolean withDescriptor) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.XmlFileParseException, org.craftercms.core.exception.StoreException - Specified by:
findItem
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.XmlFileParseException
org.craftercms.core.exception.StoreException
-
findItems
public List<org.craftercms.core.service.Item> findItems(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) throws org.craftercms.core.exception.InvalidContextException, org.craftercms.core.exception.XmlFileParseException, org.craftercms.core.exception.StoreException - Specified by:
findItems
in interfaceorg.craftercms.core.store.ContentStoreAdapter
- Throws:
org.craftercms.core.exception.InvalidContextException
org.craftercms.core.exception.XmlFileParseException
org.craftercms.core.exception.StoreException
-
executeIfNotPreloadedOrIfExistsInPreloadedPaths
-
findPreloadedAncestor
protected PreloadedFolder findPreloadedAncestor(List<PreloadedFolder> preloadedFolders, String path)
-