Go like so:

<cflock thisbadboyup>
        <cfif IsDefined("application.whatchamacallit")>
                <cfset jimmymack=1>
        </cfif>
</cflock thisbadboyup>

<cfif IsDefined("jimmymack")>
        all your truckloads of code here
</cfif>

> -----Original Message-----
> From: Edward Chowdhury [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 29, 2001 2:44 PM
> To: Fusebox
> Subject: RE: Questions about CFLOCK
>
>
> Awesome thanks for the link Jaime. It did clear up some things
> but there are
> still some additional questions I have that weren't answered.
>
> 1) What is the difference between named and scoped locks that would result
> in named locks being ~4 times faster?
>
> 2) Do I need to lock a function call such as IsStruct or StructKeyExists
> with a readonly lock? Is this considered "reading" the variable?
> Logic tells
> me that I do need to, which is a really big pain in the neck because it
> becomes really cumbersome to implement a lock such as this:
> <CFLOCK name="readUserInfo" timeout="2" type="READONLY">
>   <CFIF IsStruct(application.userInfo)>
>       many lines of code
>  </CFIF>
> </CFLOCK>
>
> In the paper they say you should just copy the structure to a
> request scoped
> object and then do your transformations on it, such as reading:
>  <CFLOCK name="readUserInfo" timeout="2" type="READONLY">
>    <CFSET request.dsn = application.dsn>
>  </CFLOCK>
>  <CFQUERY name=="test" datasource="request.dsn">
>   Sql here
>  </CFQUERY>
>
> The problem with using this approach on functions such as IsStruct is that
> YOU DON'T KNOW IF THAT VARIABLE OR KEY IS THERE. That's why you're testing
> for it's existence. If you don't know that a variable is there then it's
> totally pointless to implement something like this because it
> will crash at
> some point:
>
> <CFLOCK name="readUserInfo" timeout="2" type="READONLY">
>   <CFSET request.userInfo = application.userInfo>
> </CFLOCK>
>  <CFIF IsStruct(request.userInfo)>
>       many lines of code
> </CFIF>
>
> I guess the way around it is to CFPARAM application.userInfo at the
> beginning of the page, but it still seems REALLY KLUNKY!
>
> edward chowdhury
>
> -----Original Message-----
> From: Jaime Bonilla [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 29, 2001 4:39 PM
> To: Fusebox
> Subject: RE: Questions about CFLOCK
>
>
> http://www.allaire.com/handlers/index.cfm?ID=17318&Method=full
>
> The article by Jim Schley from Allaire explains best practices for using
> CFLOCK.
> In this article he addresses your problem and there is a solution
> that fits
> your problem below.
>
> >Would it be like this:
> > 1)
> ><CFLOCK name="readUserInfo" type="READONLY">
> ><CFIF IsStruct(application.userInfo)>
> >about 50 to 60 lines of code
> ></CFIF>
> ></CFLOCK>
>
> >or like this:
> >2)
> > <CFLOCK name="readUserInfo" type="READONLY">
> ><CFIF IsStruct(application.userInfo)>
> ></CFLOCK>
> >about 50 to 60 lines of code
> ></CFIF>
>
> In the interest of keeping messages short I recommend you read the article
> to understand his solution.
>
> Jaime
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to