Adobe COLDFUSION 9 Manual page 262

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Place the
tag before any code on your page that generates output, typically at the top of the page body. For
cfcache
example, the following tag tells ColdFusion to cache the page on both the client and the server. On the server, the page
is cached in the e:/temp/page_cache directory. ColdFusion retains the cached page for one day.
<cfcache timespan="#CreateTimespan(1, 0, 0, 0)#" directory="e:/temp/page_cache">
Important: If an Application.cfm or Application.cfc page displays text (for example, if it includes a header page), use the
tag on the Application.cfm page, in addition to the pages that you cache. Otherwise, ColdFusion displays the
cfcache
Application.cfm page output twice on each cached page.
Flushing cached pages
ColdFusion automatically flushes any cached page if you change the code on the page. It also automatically flushes
pages after the expiration time span passes.
Use the
tag with the
cfcache
optionally specify the directory that contains the cached pages to be flushed and a URL pattern that identifies the pages
to flush. If you do not specify a URL pattern, all pages in the directory are flushed. The URL pattern can include asterisk
(*) wildcards to specify parts of the URL that can vary.
When you use the
cfcache
page is cached on the client system, it is deleted, and a new copy gets cached the next time the client tries to access the
ColdFusion page.
The following example flushes all the pages in the e:/temp/page_cache/monthly directory that start with HR:
<cfcache action="flush" directory="e:/temp/page_cache/monthly" expirURL="HR*">
If you have a ColdFusion page that updates data that you use in cached pages, the page that does the updating includes
a
tag that flushes all pages that use the data.
cfcache
For more information on the
Caching parts of ColdFusion pages
In some cases, your ColdFusion page contains a combination of dynamic information that ColdFusion must generate
each time it displays the page, and information that it generates dynamically, but that changes less frequently.
ColdFusion 9 provides granular control over caching. You can cache fragments of page that lets you cache the
infrequently changed content.The following example illustrates fragment caching:
attribute to immediately flush one or more cached pages. You can
action="flush"
tag to flush cached pages, ColdFusion deletes the pages cached on the server. If a flushed
tag, see the CFML Reference.
cfcache
Last updated 8/5/2010
257

Advertisement

Table of Contents
loading

Table of Contents