|
|||
IntroductionAlthough the OpenCms template mechanism is fast, it is often handy to cache certain dynamically created pages or page elements to decrease the number of database queries at runtime. The use of a caching mechanism can increase the performance of your Website. For example, to build a page navigation it requires a lot of database queries. If a navigation can be cached, it is build only once and then called from the cache. Please look at the FlexCache examples to understand the caching mechanism. The FlexCacheThe FlexCache is a new cache implementation for OpenCms pages. It is currently used only to cache JSP and elements included by JSP, but it is likely that it will be extended to other resource types in the future. The FlexCache is an evolution of the "Element Cache" of earlier OpenCms versions, based on the same principles but much easier to use.
The FlexCache is able to cache a page and all sub-elements of a page.
All elements are cached as separate entries. Headers and redirects are also cached.
This means if you have a page (a) that includes a sub-element (b), both (a) and (b) will be cached, not just one combined entry for (a+b).
Every element has it's own cache directives which are attached to the file property
Here's a simple example on how to use the FlexCache directives:
Let's say you have a website accessible for all users with optional login.
In case a user is not logged in, a small area in your template should display a simple "Please log in here" HTML form.
If the user has successfully logged in, this small area should be replaced by a "You are logged in as user xxxx" message.
With the FlexCache, you just place the whole login-area in a sub-element that gets included by the main template.
You could then set the cache directives of the main page to The FlexCache is very powerful and there are many more hands-on, real world scenarios how it can be used. Please have a look at the Flex Examples which are available as a separate module for a demonstration. The rest of this page describes the various configuration options for the FlexCache. Some simple examples to show how to use the FlexCache FlexCache Configuration Options Example FlexCache configuration settings for the file Usage of the FlexCache Administration page in the OpenCms backoffice. Introduction on how to attach FlexCache directives to resources. FlexCache Directives Reference Reference and explanations of all possible FlexCache directives. Examples to illustrate the usage of FlexCache directives on resources. Description how to control the internal buffering of template based pages. FlexCache Request Parameters Reference Reference of all FlexCache request parameters to control the flex cache. Flex Cache: LRU cache policy test page A page to test the new and improved LRU policy of the FlexCache |
|||
©2005 Alkacon Software GmbH (http://www.alkacon.com) - The OpenCms experts |