Thanks for your examples Mike.  I was just about to post back to another tip 
about how to deal with changes to session variables, but your OnRequestEnd 
tip has sorted that out for me.

Thanks for your advice.

>From: "Mike Brunt" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: CF-Talk <[EMAIL PROTECTED]>
>Subject: RE: Locking Session Vars (CF5)
>Date: Mon, 25 Nov 2002 18:30:24 -0800
>
>Anthony, yes you do need to lock variables as shown in your example as a
>ReadOnly lock, believe when I tell you not locking can be very debilitating
>to an application.  There are alternatives, for instance we create and read
>all our Session variables in the request scope which does not need to be
>locked then we use these two pieces of code as follows: -
>
>In Application.cfm
>
><cflock scope="SESSION" timeout="30" type="READONLY">
>               <cfset structappend(request,Duplicate(session))>
></cflock>
>
>In OnRequestEnd.cfm
>
><cflock scope="SESSION" type="EXCLUSIVE" timeout="30">
>       <cfset structAppend(session,Duplicate(request))>
></cflock>
>
>Using this method you can write read all variables as request while using
>the Session scope to persist them.  You could then recode all your session
>vars to request either in one large exercise or if this is too big a job
>selectively change them as they cause issues.  Hth.
>
>Kind Regards - Mike Brunt, CTO
>Webapper
>Blog http://www.webapper.net
>Web site http://www.webapper.com
>Downey CA Office
>562.243.6255
>AIM - webappermb
>
>Web Application Specialists
>
>
>-----Original Message-----
>From: Antony Sideropoulos [mailto:[EMAIL PROTECTED]]
>Sent: Monday, November 25, 2002 6:08 PM
>To: CF-Talk
>Subject: Locking Session Vars (CF5)
>
>
>Hi everyone
>
>Under the philosophy that rules are made to be broken, I have routinely
>broken the rule about always locking session variables.
>
>However, I'm trying to mend my ways.
>
>My question is this:
>
>Do I need to lock my session variables in the following example?  If so,
>what is the best / quickest / easiest way to do so:
>
><CFIF IsDefined("Session.Collections.Role") AND (Session.Collections.Role 
>EQ
>"Medium" or Session.Collections.Role EQ "High")?
>
>To my mind, having to code a lock for the session variable used in the 
>above
>if statement adds a lot of extra lines of code, and takes longer to 
>develop.
>
>(My CF5 administrator settings are No automatic checking or locking for
>server, application and session scope vars, and the single threaded 
>sessions
>box is not checked.)
>
>TIA
>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

Reply via email to