To cache a portion of a page, surround it with this tag, as in:
<prefix:cache attributes> ... page content ... </prefix:cache>
Where prefix is the tag prefix that you assigned the tag library when declaring it in the taglib directive in your page source, and attributes is a list of attribute-value pairs to set the attributes described in Table 5-2.
Attribute |
Comments |
---|---|
parameters |
A comma-delimited list of request parameters to include in the key. A value of “*” includes all parameters in the key. If not specified, all parameters are included in the key. |
attributes |
A comma-delimited list of session attributes to include in the key. A value of “*” includes all session attributes. If not specified, no session attributes are included in the key. |
localeSensitive |
Set this attribute to true if locale-sensitive headers are to be included as part of the key. The default is false, which omits locale-sensitive headers from the key. |
headers |
A comma-delimited list of request headers to include in the key. The default is to include no headers in the key. |
timeout |
Specifies how long, in seconds, an entry in the cache remains valid. The default value is 600. |
name |
Allows you to specify a unique name, so that a cache can be shared across multiple pages. If you do not specify a name, the default value is computed so that each page has one cache for all the tags within that page, and each occurrence of the cache tag is assigned an ID that is unique within the page. You can specify a name to cache parts of a response that occur on several pages: data computed on one page can be read from cache and used in another page. |
scope |
Specifies the scope in which data is stored in the cache. Can be either session or application. The value session indicates that only pages in the same session can view the cached data. The default, application, indicates that all pages in the Web application have access to the cached data. |
maxEntries |
Specifies the a size (number of entries) in the cache. If not specified, the default is 1000. |
When recompiling a JSP, EAServer flushes any cache entries that are used in the page. When refreshing the Web application, EAServer refreshes all caches that are scoped to the application. You can also flush caches programmatically using the flushCacheByKey or flushCacheByScope tags.