Highlighted

CFCACHE cache <item> already exists

New Here ,
Dec 10, 2014

Copy link to clipboard

Copied

Hi,

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" >

191:        </cfif>

...

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

net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:920) at

...

cfapplication2ecfc814216694$funcONREQUEST._factor1(C:\inetpub\vhosts\example.org\httpdocs\application.cfc:190) at

I'm not sure if I'm using cfcache incorrectly?

Views

534

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

CFCACHE cache <item> already exists

New Here ,
Dec 10, 2014

Copy link to clipboard

Copied

Hi,

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" >

191:        </cfif>

...

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

net.sf.ehcache.CacheManager.addCacheNoCheck(CacheManager.java:920) at

...

cfapplication2ecfc814216694$funcONREQUEST._factor1(C:\inetpub\vhosts\example.org\httpdocs\application.cfc:190) at

I'm not sure if I'm using cfcache incorrectly?

Views

535

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Dec 10, 2014 0
New Here ,
Dec 11, 2014

Copy link to clipboard

Copied

Please provide us ColdFusion server version and update details on which you faced this issue. We will look into this further.

Thanks,

Akhila.

Adobe ColdFusion Team.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 11, 2014 0
New Here ,
Dec 14, 2014

Copy link to clipboard

Copied

Hi Akhila,

The server version is 9.0.2.282541.

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

Regards,

Mark

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Dec 14, 2014 0