Class AbstractSimplePageElementCachePolicy

java.lang.Object
org.ametys.web.cache.pageelement.AbstractSimplePageElementCachePolicy
All Implemented Interfaces:
PageElementCachePolicy
Direct Known Subclasses:
AbstractACLPageElementCachePolicy, CalendarServiceCachePolicy, ContentZoneItemCachePolicy, ExplorerResourcesServiceCachePolicy, FilteredContentsServiceCachePolicy, GlossaryContentsCachePolicy, GlossaryServiceCachePolicy, InsertProgramServiceCachePolicy, LinkDirectoryServiceCachePolicy, NewsletterArchiveServiceCachePolicy, SearchPagesServiceCachePolicy, SearchServiceCachePolicy, SurveyDisplayServiceCachePolicy, TagCloudServiceCachePolicy, WordCloudServiceCachePolicy

public abstract class AbstractSimplePageElementCachePolicy extends Object implements PageElementCachePolicy
Base class for simple PageElementCachePolicy only based on event ids.
Implementations should provide a list of event ids for which the cache should be removed. Be aware that for all other events, the returned value will be KEEP.
  • Constructor Details

  • Method Details

    • shouldClearCache

      public final PageElementCachePolicy.PolicyResult shouldClearCache(String workspace, Site site, String pageElementType, Event event)
      Description copied from interface: PageElementCachePolicy
      First pass of event processing, at the type level.
      Returning NEED_MORE_INFORMATION eventually leads to the second pass, which is more precise, and also depends on a particular element, but is more costly to compute.
      Returning null means that this policy declares itself as not concerned by the current event.
      Specified by:
      shouldClearCache in interface PageElementCachePolicy
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the page element type.
      event - the current event.
      Returns:
      the policy result or null if this policy declares itself as not concerned.
    • _supports

      protected boolean _supports(Event event, String workspace)
      Checks if the event is supported.
      Parameters:
      event - The event
      workspace - The JCR workspace.
      Returns:
      If true, the cache should be clear
    • _getRemovingCacheEventIds

      protected abstract List<String> _getRemovingCacheEventIds(String workspace)
      Returns all event ids for which the cache should be removed.
      Parameters:
      workspace - the current JCR workspace.
      Returns:
      all event ids for which the cache should be removed.
    • shouldClearCache

      public final PageElementCachePolicy.PolicyResult shouldClearCache(String workspace, Site site, String pageElementType, String elementId, Event event)
      Never called because the first-level method never returns NEED_INFORMATION.
      Specified by:
      shouldClearCache in interface PageElementCachePolicy
      Parameters:
      workspace - the current JCR workspace.
      site - the current site.
      pageElementType - the page element type.
      elementId - the current element id.
      event - the current event.
      Returns:
      the policy result.