User Guide

20 CFML Language Reference
CFCACHE
CFCACHE allows you to speed up pages considerably in cases where the dynamic
content doesn’t need to be retrieved each time a user accesses the page. To accomplish
this, it creates temporary files that contain the static HTML returned from a particular
run of the ColdFusion page.
You can use CFCACHE for simple URLs and URLs that contain URL parameters.
Syntax <CFCACHE
ACTION="action"
PROTOCOL="protocol name"
TIMEOUT="timeout date-time"
DIRECTORY="directory name for map file"
CACHEDIRECTORY="directory name for cached pages"
EXPIREURL="wildcarded URL reference"
PORT= "port-number">
ACTION
Optional. Specifies one of the following:
CACHE — Specifies server-side caching. The default is CACHE.
FLUSH — Refresh the cached page. If you specify FLUSH, you can also specify
the DIRECTORY and EXPIREURL attributes.
CLIENTCACHE —Specifies browser caching.
OPTIMAL—Specifies optimal caching through a combination of server-side
and browser caching.
See the Usage section for more information.
PROTOCOL
Optional. Specifies the protocol used to create pages from cache. Specify either
HTTP:// or HTTPS://. The default is HTTP://.
TIMEOUT
Optional. DateTime that specifies the oldest acceptable cached page. If the cached
page is older than the specified datetime, ColdFusion refreshes the page. By
default, ColdFusion uses all cached pages. For example, if you want a cached file
to be no older than 4 hours, code the following:
<CFCACHE TIMEOUT="#DateAdd("h", "-4", Now() )#">
DIRECTORY
Optional. Used with ACTION=FLUSH. Specifies the fully qualified path of a
directory containing the cfcache.map to be used when ACTION=FLUSH. The
default is the directory of the current page.