o

Tag cache

Component Information 
InfoValue
Component Typeorg.omnifaces.component.output.Cache
Handler ClassNone
Renderer TypeNone
DescriptionNone
Attributes 
NameRequiredTypeDescription
keyfalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
Optional key used to store content in the cache. If no key is specified, a key is calculated based on the client Id of this component.

While auto-generated keys can be convenient, note that in the face of dynamic behavior on a view the id of a component and thus the cache key can change in ways that are difficult to predict.

Keys are relative to the scope for which they are defined, meaning a key "foo" for the a session scoped cache will not conflict with a key of the same name for an application scoped cache.

scopefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
Optional scope identifier used to set the scope in which caching takes place. If no scope is specified, the default scope "session" will be used.

The supported scopes depent on the caching provider that is installed via the org.omnifaces.CACHE_PROVIDER. If no such provider is installed, a default one is used that supports scopes "session" and "application".

A runtime exception will be thrown if an unsupported value for scope is used.

timefalsejavax.el.ValueExpression
(must evaluate to java.lang.String)
Optional amount of time in seconds for which the cached content is valid (TTL). This is counted from the moment content is actually added to the cache. If no time is provided the content will be subject to the global cache settings, and in absence of these are subject to the behavior of the cache implementation that is used. The default cache implementation will simply cache indefinitely.

Whether the content is actually removed from the cache (to preserve memory) after the given time has elapsed is dependend on the actual cache implementation that is used. The default cache implementation will NOT do this automatically, but will instead remove it only when the cache item is being accessed again.

Following the above, new content will only be inserted into the cache following a page request. A time of e.g. 30 will not cause new content to be inserted into the cache at 30 seconds intervals.

Note that this component does not support a cache loader and locking mechanism. This means after content times out, several simultaneous page requests may render the same content and it's undetermined which of those will end up being cached.

useBufferfalsejavax.el.ValueExpression
(must evaluate to java.lang.Boolean)
Switches to an alternative method to grab the content generated by the children of this component. Default is false.

Normally this content is obtained by replacing the so-called response writer when the parent Cache component delegates rendering to its children. However, in some cases (like h:form) there is an amount of post-processing being done on the response outside the context of this parent - child delegation.

Via this switch, the full response is buffered if the cache doesn't contain content for this component and special markers are inserted surrounding the children's rendering. Afterwards, the content between the markers (if any) is extracted and inserted into the cache. Note that the full response is only buffered incase there's no value in the cache. For all other requests this buffering will not happen.

Since this is clearly a more resource intensive and invasive method to grab content, it's not enabled by default. In addition to setting this attribute to true, the org.omnifaces.servlet.BufferedHttpServletResponse Servlet Filter needs to be configured to filter the Faces Servlet (or alternatively just the pages for which the buffering method should be used).

resetfalsejavax.el.ValueExpression
(must evaluate to java.lang.Boolean)
Resets the cache when set to true. Default is false.

This attribute can be used to reset the cache, meaning that the first time the cache component is rendered again, it will re-render its children and will cause any cached value expressions (via o:cacheValue) to be re-evaluated when its next referenced.

Note that this value has to remain true until the cache component is rendered, after that it should be set to false again otherwise the cached content will be reset again at the next rendering.

disabledfalsejavax.el.ValueExpression
(must evaluate to java.lang.Boolean)
Disables the cache when set to true. Default is false.

This attribute can be used to disable the cache (temporarily). In disabled state the children will be rendered directly and cached content (if any) will not be used, nor will the rendering outcome of the children be cached.

When the attribute is set to false again any content that was cached before the cache was disabled will be shown again if said content is still available in the cache. The content that was rendered when the cache was disabled has no effect on any such previously cached content.

Output generated by Vdldoc View Declaration Language Documentation Generator.