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.


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.

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.




comments powered by Disqus