[coldbox-3.5.3] cfthread + application storage plugin

my code:

thread action=“run” name=“printAnswer”{
getApplicationStorage().setVar(“test”,“test”);
}

on a seperate event:

getApplicationStorage().getVar(“test”);

shows as null.

also tried passing in the storage plugin into the thread:

thread action=“run” name=“printAnswer” applicationStorage=getApplicationStorage(){
applicationStorage.setVar(“test”,“test”);
}

now… using application.test = “test”, works fine.

If you dump the application scope what do you see?

Is the “set” thread running AFTER the other request tries to “get”?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

hey Brad.

dumping the app scope, i see all the cb keys and my ‘test’ key.

the ‘set’ thread is running before the get.

applicationstorage().getStorage() shows null, too.

Are you using ACF or Railo? Any chance you have NULL support enabled?

And to confirm, when you dump out the application scope, you see a struct in it called “cbstorage”, and inside of that you see a key called “test” with a value of test?

Is there any chance that clearAll or removeStorage could be getting called prior to the get? Maybe reinitting the framework or something?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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

Brad…

your thorough and simple approach to problem solving is bad-a.

i was re-initing.

thanks!

does the application storage use the timeout in CF?

i have variables that I want to timeout of the application scope at a certain time, should i just use cachebox instead?

Yes, the application scope will be timed out by your CFML engine. If you have data that should only live a certain amount of time, I would recommend using CacheBox as you suggested. A provider such as the concurrentHashMap still still ultimately be stored in the application scope, but CacheBox will give you much better control over the lifespan.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

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