I am looking for a way to disable and reenable caching at runtime. I want a “switch” (set of radio buttons) in my application admin area where I can turn off caching for the whole application.
I tried using cachebox.replaceCache(“mycache”, a_blackhole_cache") but then I get errors when my code hits the lookup() method.
Any ideas? My main cache uses the CFProvider provider.
You could try setting an Application variable to control which cache namespace you are saving to.
Then, create two caches. There is an actual “BlackHole” cache that comes with ColdBox which you could use.
So, you update your “application.activeCache” variable (or whatever you call it) with the name of your desired cache, then, your production code can look something like