[Colbox 3.8.0] RC/PRC memory question

I have a handler that does a few queries and then join them into one. Then I do a cfloop using the same query and create some Structs / Arrays which I save them in RC / PRC
Then, in a View I use rc.structname.val to display some data.

A) Is a good idea (good practice) to place those Arrays/Structs into RC or PRC? to use them in some View?
B) Thinking that 1000 users are requesting the same data… what would happen?

Thanks guys


We take the approach that prc is anything that is server-generated. We do
reads/writes to them while rc is from the user, so we make no
modifications, but do read from it. So in your case, we'd use prc. Also, we
might have a model do the work of the query. Even if it is typical in the
handler, we might make a handler model for things like user permission

If 1000 users are requesting the exact same data, you can set the cfquery
to cache the results (locking down change for an arbitrary amount of time).
Only works in some instances (such as lists of states in the US) where data
just doesn't change often. What kind of data do you have?

It’s best practice to leave the rc to only represent user from the client/user. Therefore, prc would be used for your server-generated data.

Whether you use rc or prc has no bearing on memory regardless of the number of users. They’re both just structs that live in the requestContext object that lives in the ColdFusion request scope. Are you concerned with performance or race conditions? The former might be addressed with caching, and the latter should be irrelevant as long as you’re varring your variables so your code is thread safe.



ColdBox Platform Evangelist
Ortus Solutions, Corp

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