Cache configuration

From Resin 3.0

Jump to: navigation, search
40px-Edit-clear.png This article requires cleanup and may refer to a legacy version of Resin.

Please visit http://www.caucho.com/documentation/ for the most up-to-date documentation.

See Proxy Caching for Resin's proxy caching. Documentation is at http://www.caucho.com/resin-3.0/performance/caching.xtp

Contents

<cache>

The <cache> tag in the <server> block enables and configures the proxy cache. If the <cache> tag is missing, then caching is disabled.

Attribute Description default
path Location of the cache file cache/cache.db
enable True if the cache is enabled true
enable-range True if the cache should support HTTP Range requests true
entries Number of LRU entries in the cache 8192
memory-size How much memory to allocate to memory buffers 8M
max-entry-size Largest page size to be cached 1M
disk-size The maximum size of the cache 2G

The sizes use the Bytes Configuration syntax for the sizes.

resin.conf

<resin xmlns="http://caucho.com/ns/resin">
  ...
  <server>
    <cache path="cache" memory-size="32M"/>
    ...
  </server>
</resin>

<cache-mapping>

<cache-mapping> sets the Expires or Cache-Control: max-age headers on a cacheable page. Non-cacheable pages or pages with Expires headers or Cache-Control: max-age are not affected.

A cacheable page is a page with an Last-Modified or an ETag header. Resin's FileServlet, for example, sets both headers but does not set an Expires tag.

In other words, a JSP page or servlet that does not set any headers will not be affected by <cache-mapping> (since Resin doesn't consider it cacheable.)

<cache-mapping> uses the Period Configuration for its expire time.

resin-web.xml

<web-app xmlns="http://caucho.com/ns/resin">
  <cache-mapping url-pattern="*.html" expires="60s"/>
  ...
</web-app>
Personal tools