So what does that mean. Well I'll try to do a quick explanation, thread safe is any variable that is dedicated to a SINGLE user will NOT be shared to other users. For example, in a object a "private" variable is NOT thread safe. So if many users use the same object (implementation of a class), then we must make sure the variables being passed around are LOCAL to that function. Therefore, in a CFC (depending on language) you must force your function variables to be LOCAL to the function only.
In CF8 use of the VAR keyword provides this
<cfset var myLocalVar = "" />
In CF9 the use of the scope LOCAL provides this
<cfset local.mylocalvar="" />
So for those of us still on CF8, i recommend using the following.
<cfset var local=StructNew() /> *reader Jason found mistake in my post*
and then the rest of the code you can use
<cfset local.myLocalVar = "" />
without using the VAR keyword.
Also, as Sean Corfield commented below, using this methodology will NOT cause conflict with CF9 local scope.
Also, here is another blog post on the subject
4 comments: