Problem with cacheBox and MemCache on Railo?

Hi all,

For a big application we recently switched to using an external
memcached server to use with a Railo cluster of two webserver.

We are using the latests version of Coldbox, with Cachebox as our
cacheengine.

But we are seeing some strange behaviour in the cache. I have created
a sample page to demonstrate:

What I do, is the following:

<cfset var cacheRef = 'test_cache_3'>
<cfif variables.cacheManager.lookup(cacheRef)>
  <cfset tmpVar = variables.cacheManager.get(cacheRef)>
<cfelse>
  <cfset tmpVar = now()>
  <cfset variables.cacheManager.set(cacheRef, tmpVar, 2, 2)>
</cfif>

<cfdump var="#variables.cacheManager.lookup(cacheRef)#">
<cfdump var="#tmpVar#">

When I run this code the first time, the item is placed in the cache.
As you can see, I have a timeout of two minutes. But the cache is
never cleared. When I use the native Railo tags for the cache, it
works as expected and the cache is cleared:

<cfset cachePut('hello','Hello
World!!',createTimespan(0,0,0,10),createTimespan(0,0,0,10),'mmg_products')>
<cfoutput>#cacheGet('hello', true, 'mmg_products')#</cfoutput>

That works like I would expect it, and clears the cache after 10
seconds.

Am I doing something wrong, or are there other people experiencing
this problem as well? I have also tried using a different caching
provider in Railo, (eh_cache lite) but with the same results.

Hope you can help!

Kind regards,

Erik-Jan Jaquet

Erik,

Did you add a cachename property to the cachebox config equal to ‘mmg_products’?
Luis F. Majano
President
Ortus Solutions, Corp

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

Hi Luis,

Thanks for your reply! Yes, I did add the cachename to the cachebox
config:

caches = {
// Named cache for all coldbox event and view template caching
  template = {
    provider = "coldbox.system.cache.providers.RailoColdBoxProvider",
    properties = {
      cacheName="mmg_templates"
    }
  },
  // Named cache for all coldbox event and view template caching
  product = {
    provider = "coldbox.system.cache.providers.RailoColdBoxProvider",
    properties = {
      cacheName="mmg_products"
    }
  }
}

And in my handler, I put the cachebox into the variables scope like
this:

<cfproperty name="cacheManager" inject="cachebox:product">

So I don't think there is anything wrong there...

Kind regards,

Erik-Jan

seems weird, because if you open the railo provider it uses your same cacheput operations, strange.
Luis F. Majano
President
Ortus Solutions, Corp

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

I know it seems weird, but I still see it happening :wink: I think I
figured it out, though.

In my cachebox example, I am using 2 as the value for timeout. In the
cacheput it takes a createtimespan. When I feed the createtimespan to
the cachemanager.set method, it seems to be working like expected.

Does that make sense?

Erik-Jan

This weekend I had a similar experience using the CF Provider and EHCache with ColdFusion 901; however, I assumed it was a misconfiguration on my part and have not yet revisited it.

I need your help on this one guys, please review the cf providers and let me know please

Luis F. Majano
President
Ortus Solutions, Corp

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

Ok, I added a fix on github for this, to use createTimeSpans now instead of minutes passed through. Please use this on github and let me know.

Luis F. Majano
President
Ortus Solutions, Corp

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