How can I cache a ColdFusion page on the client machine?
Setting the action attribute of the <cfcache> tag equal to "clientCache" gives you programmatic control over whether a client browser should reload a ColdFusion page, or if it can use its local cached copy of the ColdFusion page.
Because the page is being stored on the client side, you can cache user specific versions of a dynamic web page without fear of client data being shown to the wrong client. This is a great technique to help speed up user specific pages that either have heavy access patterns, or take a while to display. It is also nice because client-cached files do not take up resources on the ColdFusion server.
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.
A code sample for using the <cfcache> tag to cache a ColdFusion page on the client machine would look as follows:
<cfcache action = "clientCache" directory = "C:/temp/cache" timespan = "#createTimeSpan(0,0,1,0)#">
This question was written by Jeremy Petersen
It was last updated on February 22, 2006.