Name

cfcache

Synopsis

<cfcache>

Caches a ColdFusion page for faster access by writing a temporary static HTML version of the page to disk (either server-side or in the client’s browser cache, or both). To cache a ColdFusion template, just add the cfcache tag to the top of the page.

When the cfcache tag caches a page, two files are actually written to the server. First, a temporary file (with a .tmp extension) is created that contains the HTML necessary to generate the static version of the page. A mapping file contains the mapping to the temp file, as well as a timestamp that determines when to expire the cached file. The name for the mapping file is determined by appending the hash of the current URL (see Hash( ) in Appendix B) to cfcache_. This results in filenames like this: cfcache_D6BF3A60769FD03FE598BB2E8490CB11.tmp. When using the cfcache tag, there are a few additional points that should be considered:

  • Templates that generate errors don’t get cached.

  • Pages generating personalized content should be cached on the client only (action="ClientCache") to avoid serving the cached content to people who are not intended to see it.

  • By default, the cfcache tag suppresses all debugging information for a ColdFusion template. To use debugging within a cached page, you must explicitly turn it on for the template using the cfsetting tag.

  • Simultaneous Requests in the ColdFusion Administrator must be set to a minimum of 2 for the cfcache tag to work.

  • In ColdFusion MX, it’s now possible to ...

Get Programming ColdFusion MX, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.