I've been doing a bit of fiddling around with caching stuff, and come up
with this for a custom tag that can be wrapped around the cfswitch:
<!---**** start of cunning_cacher ****--->
<!--- this could be sorted out in formURL2attributes (if it survives...)
--->
<CFSET cachefile = ListChangeDelims(request.attributeslist,"+", "&")>
<CFSET cachefile = ListChangeDelims(cachefile,"+", "=")>
<CFSET cachefile = cachefile & ".htm">
<CFIF ThisTag.ExecutionMode IS "start">
<CFIF FileExists("d:\www\cachetest\#cachefile#")>
<CFINCLUDE TEMPLATE="cachetest/#cachefile#">
<CFEXIT METHOD="EXITTAG">
</CFIF>
<CFELSE>
<CFFILE ACTION="WRITE"
FILE="d:\www\cachetest\#cachefile#"
OUTPUT="#ThisTag.generatedContent#">
<CFINCLUDE TEMPLATE="cachetest/#cachefile#">
<CFSET ThisTag.GeneratedContent = "">
</CFIF>
<!---**** // end of cunning_cacher ****--->
Apart from the obvious chore of deleting cached files when the dB is
updated, does anyone have any comments, see any drawbacks/problems?
Cheers
Bert
ps Oh yeah, and it wouldn't work too well if you're using any kind of
client/session management...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists