O'Reilly logo

Programming ColdFusion MX, 2nd Edition by Rob Brooks-Bilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required