Package org.ametys.web.cache.pageelement
Class PageElementCache
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.web.cache.pageelement.PageElementCache
- All Implemented Interfaces:
LogEnabled,PluginAware,Disposable,Initializable,Component,Configurable,Contextualizable,Serviceable
public class PageElementCache
extends AbstractLogEnabled
implements Component, Contextualizable, Disposable, Serviceable, Initializable, PluginAware, Configurable
Cache the page elements renderings.
This class handles several caches, one per site and per JCR workspace.
This class handles several caches, one per site and per JCR workspace.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all stored data.voidRemoves all data associated with a JCR workspace and a site.voidRemoves all data associated with a JCR workspace, a site and a given element type.voidconfigure(Configuration configuration) voidcontextualize(Context context) voiddispose()getElementCache(String workspace, String site, String pageElementType) Returns all cached data for a given InputData, or null if none.getPageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext) Returns the data in the cache, or null if none.getPageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext) Returns the data in the cache, or null if none.getPageElementTypes(String workspace, String site) Returns all stored element types, or null if none.voidprotected booleanTest if the cache is enabled.voidremoveItem(String workspace, String site, String pageElementType, String elementId) Removes a single item from the cache.voidservice(ServiceManager manager) voidsetPluginInfo(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.voidstorePageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext, SaxBuffer content) Add a content in the cache.voidstorePageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext, SaxBuffer content) Add a content in the cache.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon role. -
DISABLE_PE_CACHE_ATTRIBUTE
"Disable page element cache" request attribute.- See Also:
-
-
Constructor Details
-
PageElementCache
public PageElementCache()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
configure
- Specified by:
configurein interfaceConfigurable- Throws:
ConfigurationException
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
setPluginInfo
Description copied from interface:PluginAwareSets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfoin interfacePluginAware- Parameters:
pluginName- Unique identifier for the plugin hosting the extensionfeatureName- Unique feature identifier (unique for a given pluginName)id- Unique identifier of this component
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
storePageElement
public void storePageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext, SaxBuffer content) Add a content in the cache.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the page element type.elementId- the element id (page id or zoneItem id).renderingContext- the current rendering context.content- the actual content.
-
storePageElement
public void storePageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext, SaxBuffer content) Add a content in the cache.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the page element type.elementId- the element id (page id or zoneItem id).subElementId- the sub-element id (page id, in case the element id is a zoneItem id).renderingContext- the current rendering context.content- the actual content.
-
getPageElement
public SaxBuffer getPageElement(String workspace, String site, String pageElementType, String elementId, RenderingContext renderingContext) Returns the data in the cache, or null if none.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the element type.elementId- the element id (page id or zoneItem id).renderingContext- the current rendering context.- Returns:
- the stored content.
-
getPageElement
public SaxBuffer getPageElement(String workspace, String site, String pageElementType, String elementId, String subElementId, RenderingContext renderingContext) Returns the data in the cache, or null if none.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the element type.elementId- the element id (page id or zoneItem id).subElementId- the sub-element id (page id, in case the element id is a zoneItem id).renderingContext- the current rendering context.- Returns:
- the stored content.
-
getPageElementTypes
Returns all stored element types, or null if none.- Parameters:
workspace- the current JCR workspace.site- the current site.- Returns:
- all stored element types.
-
getElementCache
Returns all cached data for a given InputData, or null if none.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the element type.- Returns:
- the stored content.
-
removeItem
Removes a single item from the cache.- Parameters:
workspace- the target JCR workspace or null to remove from all workspaces.site- the target site.pageElementType- the element type.elementId- the element id.
-
clear
Removes all stored data. -
clear
Removes all data associated with a JCR workspace and a site.- Parameters:
workspace- the current JCR workspace. If null, means all workspaces.site- the current site.
-
clear
Removes all data associated with a JCR workspace, a site and a given element type.- Parameters:
workspace- the current JCR workspace.site- the current site.pageElementType- the element type.
-
dispose
- Specified by:
disposein interfaceDisposable
-
isEnabled
Test if the cache is enabled.- Returns:
- true if the cache is enabled, false otherwise.
-