<cfparam name="coffee" type="black">

Very true, I was assuming that your Application structure would be large and
very complex, therefore you'd only want to copy the keys that you would
actually need for that request. And you're right, if the Struct key is
itself a complex variable, you should use Duplicate.

Suffering from too much dodgy curry and too little sleep last night.....

Alistair

-----Original Message-----
From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
Sent: 24 May 2001 12:24
To: CF-Talk
Subject: Re: Lock me up!


Great, but aren't structers considers a COMPLEX varialbe that you cannot
easily copy,
you forgot to add Duplicate()

Thanks again!

Michael Lugassy


----- Original Message -----
From: <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 24, 2001 12:04 PM
Subject: RE: Lock me up!


> 1. Depends on what you're locking! If you're locking application
variables,
> you're probably best to go for 1 or two seconds. If you're locking access
to
> a file, which might be locked for a lengthy writing process, go for
> something longer. In general, I go for one or two second timeouts with
> throwonerror="yes", then I can catch the error and display something
> meaningful to the client, rather than have them wait for ages thinking the
> server is down.
>
> 2. See 1. above !
>
> 3. In this situation, I'd go for this -
>
> <cfset Variables = StructNew()>
>
> <cftry>
> <cflock scope="APPLICATION" timeout="2" throwonerror="YES">
> <cfset VARIABLES.CatName =
> APPLICATION.cats[url.catid].catNAME>
> <cfset VARIABLES.SubCats = APPLICATION.SubCats>
> </cflock>
>
> <cfcatch type="ANY">
> <!--- Display a message --->
> <cfexit method="EXITTEMPLATE">
> </cfcatch>
> </cftry>
>
> <cfoutput>
> #VARIABLES.CatName#
>
> <!--- Your PURE HTML --->
> <cfloop index="i" from="1" to="#ArrayLen(VARIABLES.subcats)#">
> <!--- More pure HTML --->
> </cfloop>
>
> </cfoutput>
>
>
> That way you only lock for the minimum amount of time/code, which is
always
> good practice. If you cache your APPLICATION variables into a local
struct,
> you only need to lock the bit that copies the values, and you're free to
> read and write to the local struct as much as you like.
>
>
> Hope that helps
>
> Cheers,
>
> Alistair Davidson
> Senior Web Developer
> Rocom New Media
> www.rocomX.net
>
> -----Original Message-----
> From: Michael Lugassy [mailto:[EMAIL PROTECTED]]
> Sent: 24 May 2001 11:49
> To: CF-Talk
> Subject: Lock me up!
>
>
> 3 quick Qs about Locking:
>
> 1. how do you set the right timeout value? i.e - what are the rules and
> opinions on that? (longer
> time or shorter and "efficient"?
>
> 2. throwonerror? yes or no? what is recommened? assuming the program may
not
> use the current
> variable?
>
> 3. please look at this:
>
> 1. #application.cats[url.catid].catNAME#
> 2. MORE "PURE" HTML
> 3. MORE "PURE" HTML
> 4. MORE "PURE" HTML
> 5. <cfloop index="i" from="1" to="#Arraylen(application.subcats)#">
>
> 6. MORE "PURE" HTML
> 8. MORE "PURE" HTML
> 9. </cfloop>
>
> what is better? to provide 2 "quick" locks around line#1 and around
line#5-9
> or to provide a "bigger" lock around lines1-9?
> in general, when the content inside the lock is pure html, with no use of
> CF/Other Process
> and ofcourse, no other shared variable, is it necessary to close and
re-open
> another lock?
>
>
> Thanks,
>
> -=Michael
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to