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
Fields Modifier and Type Field Description protected org.craftercms.core.store.ContentStoreAdapter
actualStoreAdapter
protected org.craftercms.core.service.CacheService
cacheService
protected boolean
warmUpEnabled
-
Constructor Summary
Constructors Constructor Description CacheWarmingAwareContentStoreAdapterDecorator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.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)
-
-
-
Method Detail
-
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
protected <T> T executeIfNotPreloadedOrIfExistsInPreloadedPaths(org.craftercms.engine.cache.PreloadedFoldersAwareContext contextWrapper, String path, Supplier<T> actualCall)
-
findPreloadedAncestor
protected PreloadedFolder findPreloadedAncestor(List<PreloadedFolder> preloadedFolders, String path)
-
-