I was talking with Daria Norris this morning about an odd cfcache issue she was seeing when I discovered a simple mistake that could completely break cfcache in your application. This isn't a bug, but it could be considered a backwards compatibility issue you want to look out for. For fun, I'll post her code, and you see if you can find the issue. You don't need to save it to your file system, just know that the the result is a page that never seems to cache.

<cfcache timespan="#createTimeSpan(0,0,10,0)#" usequerystring="true" />

<cfoutput> This page was generated at #now()#<br> </cfoutput>

<cfparam name="url.id" default="no URL parm passed"> <cfoutput>The value of url.id = #url.id#</cfoutput>

Figured it out yet? ColdFusion 9 added the ability to use cfcache as a wrapper tag. This allows you to cache part of a file. So for example:

Normal, fast code. <cfcache timespan="#createTimeSpan(0,0,10,0)#"> Slow code </cfcache> Fast code again.

In the block above, ColdFusion would save the result of the generated output inside the tag and cache it. Very handy for cases where you only need to cache part of a page. And yes - you can do it more than once on a page. So given that? Do you see the error?

<cfcache timespan="#createTimeSpan(0,0,10,0)#" usequerystring="true" />

It's the trailing /. To ColdFusion, this is the same as:

<cfcache timespan="#createTimeSpan(0,0,10,0)#" usequerystring="true"></cfcache>

So technically, ColdFusion was caching - but it was caching an empty fragment. Now - I know some people are kinda anal about using xhmlt looking code. I'm not. But even I will use that syntax from time to time. If you have a ColdFusion 8 site you want to quickly scan it for this before updating to ColdFusion 9.