<< Back - Alkacon logo

OpenCms 6.0 interactive documentation:

FlexCache Directives Reference

OpenCms logo - Forward >>

FlexCache Directives Reference

The following table lists all possible FlexCache directives. These directives must be attached to a specific page using the cache property. In case you want to set more than one directive, use a semicolon ";" to separate them.

Please note: Settings for FlexCache directives are not case sensitive.

never   (default)
(= false)
This resource is not cachable. Nothing will be cached under any circumstance. This overrides all other directives that might also be given.
(= true)
This resource is cachable and there will always be the same result generated for all requests, i.e. only one variation entry for the page will be saved in the cache. This overrides all other directives (other than never and no-params) that might also be given.
user One variation entry of this resource is generated for every different user. Please keep in mind that this might lead to a great number of entries in the cache in case you have a website with many different users. Have a look at the groups directive as an alternative. You should know that any client not authorized is treated in OpenCms as user "Guest", so all requests always belong to a specific user.
uri One variation entry of this resource is generated for every "top level" URI that is requested. This is useful for navigation elements that are included as a sub-element on a page, where usually the URI of the requested page decides which entries have to be displayed in the navigation.
timeout={integer} This directive sets a timeout at which a cached resource will be invalidated. The given integer represents a minute - interval which starts at 0.00h of the day the cache key gets calculated. A value of 60 would indicate that this entry will reach it's timeout at the beginning of every full hour, a timeout of 20 indicates that the entry is invalidated at x.00, x.20 and x.40 of every hour etc. A "timed out" resource will stay in the cache and will be re-calculated the next time it gets requested.
params   or
params=(param1, param2, ...)
If you use params=(param1, param2,...) there will be one variation entry generated for every value of all listed parameters (or combination thereof). If you use params there will be one variation entry of this resource generated for every different parameter value of every different parameter. This directive is useful if you have something like a "show article" page that gets dynamically calculated from a database with something like an "id" parameter that selects the article to be displayed. So if you have a page showarticle.jsp that gets usually called like showarticle.jsp?article_id=123, you could just set the caching properties of this page to params=(article_id) and thus cache every single article page.
no-params   or
no-params=(no-param1, no-param2, ...)
This directive prevents the caching of a resource. If you use no-params the occurance of any parameter in the request will prevent caching of the resource. If you use no-params=(no-param1, no-param2,...), the occurance of any of the listed parameters will prevent caching of the resource. This directive is useful on simple forms. Usually (esp. with JSP) you will have only one URI for all requests to the form, i.e. the form is posted to it's own url and the JSP behind it handles the form validation. With the no-params directive you can cache the "first", empty view of the form, while any requests with data in the form will cause the page to be generated dynamically. Note that these "blocking" directives always overrule all other directives.
element  or
element=(element1, element2, ...)
This cache directives creates one variation of a page for every (or every listed) element. This important directive is required if multiple xmlpage elements are included from the same URI. It ensures that changes in the listed sub-elements will result in an update of the including page.
locale   or
locale=(locale1, locale2, ...)
This directive creates one variation entry of the resource for every (or every listed) locale value. This cache directive is nescessary, if locale-based localization is used for elements that are used in different language variations.
encoding   or
encoding=(encoding1, encoding2, ...)
One variation entry of the resource is created for every (or every listed) encoding value. If a sub-element is used with different encodings in different parts of a site, the caching must be encoding dependent.
schemes   or
schemes=(scheme1, scheme2, ...)
This directive causes a variation to be generated for every (or every listed) request scheme. The most often used request schemes are currently "http" or "https".
ports   or
ports=(port1, port2, ...)
This directive causes a variation to be generated for every (or every listed) server TCP port of the request. This might come handy in complex OpenCms setup scenarios where a server is addressed by multiple ports.
session=(attribute1, attribute2, ...) If you use session=(attribute1, attribute2,...) there will be one variation entry generated for every value of all listed session attributes  (or combination thereof). You must at least use one attribute value.
Note: if you are using the session cache directive in combination with the user directive, your browser might not be able to distinguish between the different versions delivered by OpenCms because of its own internal browser caching. In such an scenario, you must disable the browser caching by setting correct http headers in your OpenCms application.
ip   or
ip=(ip1, ip2, ...)
This directive causes a variation to be generated for every (or every listed) client ip addresses of the request. This enables a caching based on different client locations.

©2003-2005 Alkacon Software (http://www.alkacon.com) - The OpenCms experts