RE: [coldbox:16998] Caching

If the only place you’re storing the result object is in the request collection, then it’s probably ok but that’s not the code you shared the other day:

This shows a single result object being injected into the shared variables scope of what appears to be a singleton object. If this code still exists, you have a problem. Also, it is not necessary to set the object “back” into the rc. “result” is an object, so it gets passed by reference.

There’s only one instance of the result object in the below code. Any changes made to local.result automatically are also made to rc.result since those are both references to the same object in memory.

rc.result = wireBox.getInstance(“result”);
local.result = rc.result;
local.result.foo = ‘bar’;
writeOutput(rc.result.foo);

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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