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 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 interface ContentStoreAdapterDecorator
      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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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 interface org.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)