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
FieldsModifier and TypeFieldDescriptionprotected org.craftercms.core.store.ContentStoreAdapterprotected org.craftercms.core.service.CacheServiceprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.craftercms.core.service.ContextcreateContext(String id, String rootFolderPath, boolean mergingOn, boolean cacheOn, int maxAllowedItemsInCache, boolean ignoreHiddenFiles, Map<String, String> configurationVariables) voiddestroyContext(org.craftercms.core.service.Context context) protected <T> TexecuteIfNotPreloadedOrIfExistsInPreloadedPaths(org.craftercms.engine.cache.PreloadedFoldersAwareContext contextWrapper, String path, Supplier<T> actualCall) booleanexists(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.ContentfindContent(org.craftercms.core.service.Context context, org.craftercms.core.service.CachingOptions cachingOptions, String path) org.craftercms.core.service.ItemfindItem(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 PreloadedFolderfindPreloadedAncestor(List<PreloadedFolder> preloadedFolders, String path) voidsetActualStoreAdapter(org.craftercms.core.store.ContentStoreAdapter actualStoreAdapter) Sets the store adapter to be decoratedvoidsetCacheService(org.craftercms.core.service.CacheService cacheService) voidsetWarmUpEnabled(boolean warmUpEnabled) booleanvalidate(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:ContentStoreAdapterDecoratorSets the store adapter to be decorated- Specified by:
setActualStoreAdapterin 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, Map<String, String> configurationVariables) throws org.craftercms.core.exception.RootFolderNotFoundException, org.craftercms.core.exception.StoreException, org.craftercms.core.exception.AuthenticationException- Specified by:
createContextin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.RootFolderNotFoundExceptionorg.craftercms.core.exception.StoreExceptionorg.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:
validatein interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.StoreExceptionorg.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:
destroyContextin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.StoreExceptionorg.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:
existsin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.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:
findContentin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.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:
findItemin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.craftercms.core.exception.XmlFileParseExceptionorg.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:
findItemsin interfaceorg.craftercms.core.store.ContentStoreAdapter- Throws:
org.craftercms.core.exception.InvalidContextExceptionorg.craftercms.core.exception.XmlFileParseExceptionorg.craftercms.core.exception.StoreException
-
executeIfNotPreloadedOrIfExistsInPreloadedPaths
-
findPreloadedAncestor
protected PreloadedFolder findPreloadedAncestor(List<PreloadedFolder> preloadedFolders, String path)
-