You need a readonly lock around this because you are reading the Session 
Var. You do not need it for the Isdefined. If you are using this session 
var numerous times on the same page, I think its best to dump it into a 
local var at the top of the page within a cflock, and then reference the 
local var throughout the page. This is as opposed to locking each instance 
throughout the page - which would be slower.

<cflock scope="session" type="exclusive" timeout="10">
         <cfset mylocalvar.role=session.collections.role>
</cflock>

or just but a readonly lock around that chunk of code..


Brook

At 01:08 PM 26/11/02 +1100, you wrote:
>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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to