Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can I cache a ColdFusion page on both the client machine and the ColdFusion server?

Use the <cfcache> tag with the action attribute set to either cache or optimal. Using the <cfcache> tag for combination caching uses a combination of both client-side and server-side caching. In this model, first the client browser will be checked for a cached copy of the page, if this check fails, then the server will try to get the data from its own cache. Combination caching optimizes ColdFusion server performance and is recomended over server-side only caching.

Note:

1) The <cfcache> tag should be placed at the top your ColdFusion template.

2) The <cfcache> tag treats each distinct URL combination as its own page. So the output of foo.cfm?key=1 and foo.cfm?key=10 would be cached as separate files.

3) Combination caching should not be used for caching client specific pages.

<cfcache
action = "cache"
directory = "C:/temp/cache"
timespan = "#createTimeSpan(0,1,0,0)#">


This question was written by Jeremy Petersen.
It was last updated on March 2, 2006 at 11:58:23 AM EST.

CFML Referenced

<cfcache>

Categories

Caching

Comments

There are no comments for this entry.