3.5.2 - Accessing Cachebox in non injected CFC

Hi folks,

I have a service that I use in a backend to clear and set data into cachebox.

In the Coldbox.cfc of my app I set some settings by making a call to a standard component - i.e mysetting = new common.foo.getSettings().

Foo is the same CFC that I use in the backend that has cachebox injected, however when I access it this way it doesn’t know what cachebox is since it hasn’t been initialized with the framework.

So my question is, how could I modify the CFC so that I can access cachebox regardless of the CFC being initialize in or outside of the framework.

Thanks.

Nolan

Are you calling this from a ColdBox application?

If so then you could use the getModel() instead, which will do all the ColdBox magic when it gets instantiated.

Yes but it’s being called within the ColdBox settings dsl when the app starts up. Is getmodel() available at that point?

Thanks.

Nolan Dubeau

Load .,8,1

Should be, as that method is part of the frameworksupertype.cfc, maybe one of the CB team can confirm that.

Just out of curiosity, is that the only place you can do that?

Would an interceptor, do the same thing?

Not everything is suited for the config.cfc and you could easily use the onConfigurationLoad to use an interceptor to then do what you need to do.