RE: [coldbox:15842] Re: [cachebox-latest] How to easily disable/reenable caching?

To clarify a bit of terminology (which I was also using incorrectly), CFProvider is a provider, black hole is a store that is meant to be used with one of the two cacheBox providers.
The CFProvider uses CF9’s underlying EHCache implementation and relies on the built-in CF function cacheGetMetadata() to return object metadata.

The two CacheBox providers are Caching implementations written in CFML. Are you using CacheBox outside of the ColdBox framework? If not, you probably want to be using the CacheBoxColdBoxProvider, not the CacheboxProvider.

All that being said, I’m not sure why you’re getting metaData at all. The blackhole store doesn’t even create an indexer instance which is what actually returns metadata for CacheBox stores. I would actually expect a call to myCache.getCachedObjectMetaData() to error since it runs instance.objectStore.getIndexer().objectExists(arguments.objectKey) and getIndexer() returns void.

Can you introspect myCache a bit to determine if it was correctly replaced with the ColdBox provider using a blackhole store?

Also, how are you getting a reference to myCache? If you autowired the reference into a singleton, you may have an out-of-date reference to the old provider (which still wouldn’t explain the difference in metadata though)`

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I switched my configuration around, so that myCache was declared as a blackhole. Then I restarted ColdFusion. Then I tested the site - the data is getting cached. Then I looked at the reports - myCache and a_blackhole_cache contain the same data, and have the same number of hits and misses.

So I think there might be a bug in the blackhole objectStore, or I am setting it up wrong. Maybe you can only have one cache that uses the CFProvider? Here are my two caches (reversed from my usual setup):

I also have a 3rd cache I haven’t done anything with, called sessionCache:

I noticed on the report that it contains the same data & hits/misses as the other two caches.

On your other question, yes I am using this outside of ColdBox. I am using it in a Model-Glue application.

-Ryan

Ryan I just saw this can you post your config.

Here is the whole config.

<?xml version="1.0" encoding="UTF-8"?>

Ok, your config does not validate against the schema. Did you validate it?

Here is the valid schema:

<?xml version="1.0" encoding="UTF-8"?>

<CacheBox xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xsi:noNamespaceSchemaLocation=“http://www.coldbox.org/schema/CacheBoxConfig_1.3.xsd”>

<DefaultConfiguration

objectDefaultTimeout=“10”

objectDefaultLastAccessTimeout=“10”

useLastAccessTimeouts=“true”

reapFrequency=“2”

freeMemoryPercentageThreshold=“0”

evictionPolicy=“LRU”

evictCount=“1”

maxObjects=“100”

objectStore=“ConcurrentSoftReferenceStore”

coldboxEnabled=“false” />

signature0.jpg

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

Ah, my bad. I saw that the default cache declaration accepted objectstore as an attribute so I just assumed my additional cache declarations did also. I didn’t even really notice they are completely different tags (DefaultConfiguration vs Cache).

Now that I’m using your updated XML, the blackhole cache is working as expected, thank you.

But is it odd that in the Cachebox reporting page, all the caches show the same data? Even on the blackhole cache report, it shows the same hits & misses that the other caches do.

Also my idea about replacing the regular cache with a blackhole cache to disable caching isn’t so great - because its hard to turn it back on. I can’t simply replace the blackhole cache with my regular cache, because there is no regular cache anymore. Its been overwritten with the blackhole cache.