This element configures caching for web application components.
The following table describes subelements for the cache element.
Table A–29 cache Subelements
Element |
Required |
Description |
---|---|---|
zero or more |
Specifies a custom class that implements the CacheHelper interface. |
|
zero or one |
Allows you to change the properties of the default, built-in cache-helper class. |
|
zero or more |
Specifies a cache property, which has a name and a value. |
|
zero or more |
Maps a URL pattern or a servlet name to its cacheability constraints. |
The following table describes attributes for the cache element.
Table A–30 cache Attributes
Attribute |
Default Value |
Description |
---|---|---|
max-entries |
4096 |
(Optional) Specifies the maximum number of entries the cache can contain. Must be a positive integer. |
timeout-in-seconds |
30 |
(Optional) Specifies the maximum amount of time in seconds that an entry can remain in the cache after it is created or refreshed. Can be overridden by a timeout element. |
enabled |
false |
(Optional) Determines whether servlet and JSP caching is enabled. Legal values are on, off, yes, no, 1, 0, true, false. |
The following table describes properties for the cache element.
Table A–31 cache Properties
Property Name |
Default Value |
Description |
---|---|---|
cacheClassName |
com.sun.appserv.web .cache.LruCache |
Specifies the fully qualified name of the class that implements the cache functionality. For a list of valid values, seeCache Class Names. |
MultiLRUSegmentSize |
4096 |
Specifies the number of entries in a segment of the cache table that should have its own LRU (least recently used) list. Applicable only if cacheClassName is set to com.sun.appserv.web .cache.MultiLruCache. |
MaxSize |
unlimited; Long.MAX_VALUE |
Specifies an upper bound on the cache memory size in bytes (KB or MB units). Example values are 32 KB or 2 MB. Applicable only if cacheClassName is set to com.sun.appserv.web. cache.BoundedMultiLruCache. |
The following table lists possible values of the cacheClassName property.
Table A–32 cacheClassName Values
Value |
Description |
---|---|
com.sun.appserv.web.cache.LruCache |
A bounded cache with an LRU (least recently used) cache replacement policy. |
com.sun.appserv.web.cache.BaseCache |
An unbounded cache suitable if the maximum number of entries is known. |
com.sun.appserv.web.cache.MultiLruCache |
A cache suitable for a large number of entries (>4096). Uses the MultiLRUSegmentSize property. |
com.sun.appserv.web.cache.BoundedMultiLruCache |
A cache suitable for limiting the cache size by memory rather than number of entries. Uses the MaxSize property. |