fwCache is part of cached/purged key

I’ve mentioned this before, but fwCache doesn’t work – because the fwCache url param isn’t removed before the current key is purged – which means essentially fwCache is useless – it just purges the event including the fwCache url param – and it therefore works more like a cache bypass than a cache purge.

After reading the docs, it’s clear purging is what it’s supposed to do: http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbURLActions “This flag is used to override a cached event so it can be purged and re-cached by the framework”. So for this to work, fwCache needs to be removed from the Request Collection before the rc is serialized.

I’ve had to bodge this by doing the following:

In my caching interceptor inside the OnRequestCapture interception point I added:

if (event.valueExists(“fwCache”) {

prc.clearCache = true;

event.removeValue(“fwCache”);

}

Then in eventCachingTest inside RequestService.cfc I added:

[+157] var clearCacheKey = arguments.context.getValue(“clearCache”,false,true);

and then changed:

// Check for Event Cache Purge

[176] if ( context.valueExists(“fwCache”)){

TO

// Check for Event Cache Purge

[176] if ( context.valueExists(“fwCache”) OR clearCacheKey){

Now obviously I’m unhappy that I had to modify RequestService.cfc – but I couldn’t see a way to do this all in my interceptor as I couldn’t get the current event name at that point in the lifecycle to re-create the cachedKey coldbox creates and purge it manually.

Tom.

I’ve mentioned this before, but fwCache doesn’t work – because the fwCache url param isn’t removed before the current key is purged – which means essentially fwCache is useless – it just purges the event including the fwCache url param – and it therefore works more like a cache bypass than a cache purge.

After reading the docs, it’s clear purging is what it’s supposed to do: http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbURLActions “This flag is used to override a cached event so it can be purged and re-cached by the framework”. So for this to work, fwCache needs to be removed from the Request Collection before the rc is serialized.

I’ve had to bodge this by doing the following:

In my caching interceptor inside the OnRequestCapture interception point I added:

if (event.valueExists(“fwCache”) {

prc.clearCache = true;

event.removeValue(“fwCache”);

}

Then in eventCachingTest inside RequestService.cfc I added:

[+157] var clearCacheKey = arguments.context.getValue(“clearCache”,false,true);

and then changed:

// Check for Event Cache Purge

[176] if ( context.valueExists(“fwCache”)){

TO

// Check for Event Cache Purge

[176] if ( context.valueExists(“fwCache”) OR clearCacheKey){

Now obviously I’m unhappy that I had to modify RequestService.cfc – but I couldn’t see a way to do this all in my interceptor as I couldn’t get the current event name at that point in the lifecycle to re-create the cachedKey coldbox creates and purge it manually.

Tom.

done!

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Someone’s on a mission! J