[thelist] CF: Determining which DB used.

Raymond Camden jedimaster at macromedia.com
Wed Sep 12 13:06:48 CDT 2001

> <cflock
>  scope="application"
>  type="exclusive"
>  timeout="10"
>  throwontimeout="no">
>   <cfif NOT StructKeyExists(application, "categories")>
>     <cfset application.categories = StructNew()>
>     <!--- the rest of your setting happens here --->
>   </cfif>
> </cflock>

My beef with this, and now we are getting into the anal stuff, so,
folks, just do what you think is best here, is that you are using an
exclusive lock for every request, and it is not necessary. Even though
it's not as pretty, I do this:

<CFSET NeedInit = 0>
<CFLOCK SCOPE="Application" TYPE="ReadOnly" TIMEOUT=3>
	<CFIF NOT StructKeyExists(Application,"Init")>
		<CFSET NeedInit = 1>
<CFIF NeedInit>
	(The file I include here has the exclusive lock)

I puposely did NOT use Variables.NeedInit so I could pass URL.NeedInit
as a way to refresh my app. A security hole, yes, but not a big deal if
you aren't doing a lot of initialization.

Again, this is not to say Jeff is wrong and I am right - it's just an

Raymond Camden, Principal Spectra Compliance Engineer for Macromedia

Email    : jedimaster at macromedia.com
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

More information about the thelist mailing list