Warning!

The FlexCache is not enabled in the Offline project!

Please choose the Online project to make the examples work correctly.

 

Some FlexCache examples

On this page you find some examples to demonstrate the OpenCms FlexCache mechanism. Read the page Configuration Options to learn how to configure FlexCache in OpenCms. For a detailed description of the used cache directives look at the page Cache Directives Reference.

 

Example 1: Page inclusion with different cache directives

In this example a JSP file is included by another one.

  • The cache property of the first file is set to "never", which means that this resource is never cached.
  • The cache property of the included file is set to "timeout=1", which means that the cache entry for this file is cleared every full minute. 

Click here to have a look at the example and watch the values of the dates displayed when you refresh the example page.

You can see that you can set the caching properties for each file individually and that these directions are considered even if one file is included by another.

 

Following jsps are used in this example:

/dev-demo/flex-cache-demo/.content/jsps/example-include1.jsp

/dev-demo/flex-cache-demo/.content/jsps/example-include1a.jsp

 

Example 2: Another Inclusion

Another example for an inclusion, this time with other cache directives. The cache property of the first file is set to "always", which means that there will always be the same result generated for all requests. The cache property of the included file is set to "never". Refresh the page Example 2 to see effects of the different cache directives.

 

Following jsps are used in this example:

/dev-demo/flex-cache-demo/.content/jsps/example-include2.jsp

/dev-demo/flex-cache-demo/.content/jsps/example-include2a.jsp

 

Example 3: A simple navigation

The page simple navigation builds a simple navigation tree for the current folder. The cache property of the file is set to "uri", which means that one cache entry of this resource is generated for every "top level" URI that is called.

 

Following jsps are used in this example:

/dev-demo/flex-cache-demo/.content/jsps/navigation.jsp