As long as we're discussing rolling your own caching solution, I would like to share a solution which I find very satisfying both in its utility and its simplicity.
Basically you need to create a custom tag that converts your static HTML into a javascript source file that can be embedded in your page like this:
<SCRIPT SRC="#My_Cached_Path#" TYPE="text/jscript"></SCRIPT>
along with a mechanism that prevents the wasted effort of rewriting identical source files. The browser will then do its job by keeping a copy of this and not refreshing it as long as the mod date on the server stays the same, allowing you to use it throughout the application without having to create another copy.
I break up this task in a series of surrounding custom tags. The inner most tag converts the HTML to JavaScript by first escaping all back slashes, single quotes, and tabs and converting to document write lines like this:
ThisTag.GeneratedContent = ListChangeDelims(ThisTag.GeneratedContent, "');" & Chr(10) & "document.writeln('", Chr(10) & Chr(12) & Chr(13));
ThisTag.GeneratedContent = "document.write('" & ThisTag.GeneratedContent & "');";
The next inner most tag saves the javascript output (and any additional javascript you want to squeeze in there) to a unique file. This takes the file suffix ("js" in this case) and the file name as attributes, and assumes a special cache directory to save the file to. If not supplied with a file name, I just create one with CreateUUID() like this:
<CFSWITCH EXPRESSION="#ThisTag.ExecutionMode#">
<CFCASE VALUE="start"></CFCASE>
<CFCASE VALUE="end">
<!--- Write the content to a cache file --->
<CFSCRIPT>
Variables.CacheDirectory = Left(GetBaseTemplatePath(), Len(GetBaseTemplatePath()) - Len(CGI.SCRIPT_NAME)) & 'cache';
if(Len(Attributes.FileName)) {
Caller.CacheFile = Variables.CacheDirectory & Attributes.FileName & '.' & Attributes.FileSuffix;
}
else {
Caller.CacheFile = Variables.CacheDirectory & CreateUUID() & '.' & Attributes.FileSuffix;
}
</CFSCRIPT>
<CFFILE
ACTION="WRITE"
FILE="#Caller.CacheFile#"
OUTPUT="#ThisTag.GeneratedContent#"
ADDNEWLINE="Yes"
>
<!--- Hide from browser display --->
<CFSET ThisTag.GeneratedContent="">
</CFCASE>
</CFSWITCH>
The real power, though, is in the ability to pass a hash of the uniquely identifying qualities of the HTML you wanted to cache in the first place. (Yes, this is the mechanism I was talking about.) In my case, I'm only calling this tag inside of another tag, so I just smoosh all the simple attributes (and a unique value list or two of the complex ones) together, hash that, and pass it to the tag as the file name attribute. (Of course, you would want to see if the file with that hashed name already doesn't exist before you bother to run the tag. :-)
In some cases, of course, you are able to avoid converting to a .js file and stick with .htm files, but the caching solution is just that much simpler.