I've implemented page caching on a site by adding a call to cfcache in the application.cfc onRequest function. It all works fine on individual requests. However under load (e.g. running a broken link spider across the site) I'm getting error notifications (via the onError function) with the message "Cache A95C0BF9E9BFBC6F151F03E939D2D2D6TEMPLATE already exists". It seems like there may be two requests trying to save into the cache under the same ID? I would have thought CFCACHE should have handled locking and concurrency issues for us? We route 404s back to a main handler to "rewrite" friendly/clean URLs, so whilst these requests use different URLs they are all running the same set of components and templates.
The relevant parts of the onRequest handler in application.cfm are:
188: <!--- setup caching if enabled --->
189: <cfif getConfigValue('page_cache') eq "true" and not application.security.isLoggedOn()>
190: <cfcache timespan="#createTimeSpan(0,0,10,0)#" directory="#application.pagecachepath#" usequerystring="true" >
204: <cfcontent reset="yes" type="text/html"><cfoutput>#html.render()#</cfoutput>
205: <cfif getConfigValue('page_cache') eq "true" and not application.security.isLoggedOn()><!-- content generated at #Now()#--></cfif>
The stacktrace is:
[forum will only post when I include this one line per edit...]
net.sf.ehcache.ObjectExistsException: Cache A95C0BF9E9BFBC6F151F03E939D2D2D6TEMPLATE already exists at
I'm not sure if I'm using cfcache incorrectly?
Please provide us ColdFusion server version and update details on which you faced this issue. We will look into this further.
Adobe ColdFusion Team.
The server version is 22.214.171.1242541.
From a stackoverflow answer it looks like there might be a race condition in CF9 and CF10. coldfusion - Cache already exists error with CFCACHE - Stack Overflow