Package org.ametys.web.cache.pageelement
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 simplePageElementCachePolicy
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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.web.cache.pageelement.PageElementCachePolicy
PageElementCachePolicy.PolicyResult
-
-
Constructor Summary
Constructors Constructor Description AbstractSimplePageElementCachePolicy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract List<String>
_getRemovingCacheEventIds(String workspace)
Returns all event ids for which the cache should be removed.protected boolean
_supports(Event event, String workspace)
Checks if the event is supported.PageElementCachePolicy.PolicyResult
shouldClearCache(String workspace, Site site, String pageElementType, String elementId, Event event)
Never called because the first-level method never returns NEED_INFORMATION.PageElementCachePolicy.PolicyResult
shouldClearCache(String workspace, Site site, String pageElementType, Event event)
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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.web.cache.pageelement.PageElementCachePolicy
getPageElementTypes
-
-
-
-
Constructor Detail
-
AbstractSimplePageElementCachePolicy
public AbstractSimplePageElementCachePolicy()
-
-
Method Detail
-
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 interfacePageElementCachePolicy
- 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 eventworkspace
- 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 interfacePageElementCachePolicy
- 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.
-
-