Cache configuration

From CauchoWiki

Jump to: navigation, search


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

Contents

[edit] <cache>

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

AttributeDescriptiondefault
pathLocation of the cache filecache/cache.db
enableTrue if the cache is enabledtrue
enable-rangeTrue if the cache should support HTTP Range requeststrue
entriesNumber of LRU entries in the cache8192
memory-sizeHow much memory to allocate to memory buffers8M
max-entry-sizeLargest page size to be cached1M
disk-sizeThe maximum size of the cache2G

The sizes use the Bytes Configuration syntax for the sizes.

[edit] resin.conf

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

[edit] <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.

[edit] resin-web.xml

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




























































































































































































































































































































































































































































































































































































































































































































































































































































































































Personal tools