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

If you were using ColdBox, I’d recommend swapping out the WireBox mapping for your cache on-the-fly. Since you’re in MachII, I’d say perhaps a utility method like so:

function getMyCache() {

if(cacheEnabledSetting){
return cacheBox.getCache(“theRealOne”);

}
else {
return cacheBox.getCache(“theFakeOne”);
}

}

Then, just call getMyCache() any time you want the appropriate caching provider. That way, both providers are always configured, you’re just changing which one you reference.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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