How can I cache a ColdFusion page on the ColdFusion server?

The <cfcache> tag also gives you the ability to cache pages on the ColdFusion server by setting the action attribute equal to "serverCache". This type of caching is perfect for non-personalized pages that have high usage.

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) ServerCache caching should not be used for caching client specific pages.

A code sample would look as follows:

<cfcache 
action = "serverCache"
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.

Categories

Caching

Comments

comments powered by Disqus