Sorry but your answer kinda went over my head.

On Thu, 10 Jun 2004 10:40:23 -0700, Barney Boisvert wrote:

>In CFMX you never need to lock shared scopes just because they're shared
>scopes (this is a change from previous versions).  Now you only need to
>worry about race conditions.
>
>Think of your shared scopes as a primitive database, with each scope as a
>table, and each individual variable as a record.  The session scope is kind
>of special, because it is bound to a user, so you'd actually have a "table"
>for each user's session.  You still need to lock though, in case they have
>two browsers open, you're using a frameset, or whatever.
>
>CFLOCK is required any place you would need to use a transaction to ensure
>atomicity if you were actually talking to a database.  If you're modifying a
>single variable, you don't need a transaction (a single statement is always
>atomic).  If you're setting multiple unrelated variables, same thing,
>because each can be treated as an individual action.  If you're doing any
>kind of relative thing (such as reading, perforing an operation, and writing
>the result), you'd need a transaction, and therefore need CFLOCK.
>
>Keep in mind that CFLOCK can only lock entire scopes (I'm ignoring the
>'name' attribute), which is equivalent to locking an ENTIRE TABLE in our
>database analogy.  That means that using too much locking has a definite
>negative effect, as it will cause access to the shared scopes to become
>single-threaded, greatly reducing concurrency.  So just like with income
>tax, lock as little as possible, but never less than you have to.
>
>Cheers,
>barneyb
>
>> -----Original Message-----
>> From: Hoe [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, June 10, 2004 9:56 AM
>> To: CF-Talk
>> Subject: re: Using <cflock and when under different circumstances
>>
>> Hello,
>>
>> I'm having difficulty grasping when and when not to use
>> <cflock>? I've been using the following for session variables.
>>
>> <cflock timeout="10" type="EXCLUSIVE" scope="SESSION">
>> <cfset SESSION.aaa = "aaa">
>> <cfset SESSION.bbb = "bbb">
>> </cflock>
>>
>>
>> Let's say I'm checking a session varaible using <cfif>
>>
>> <cfif SESSION.aaa eq "?>
>> ...
>> </cfif>
>>
>> Should I also be wrapping ALL my <cfif> statements with <cflock>?
>>
>>
>> What about the below?
>>
>> <cflock timeout="10" type="READONLY" scope="SESSION">
>> <CFX_Users ACTION=""
>> USER="#SESSION.auth#" PASSWORD="#FORM.OldPassword#">
>> </cflock>
>>
>> I'm using alot of <cfloop>. Should I be wrapping all these
>> with <cflock> also>
>>
>> <cflock timeout="10" type="EXCLUSIVE" scope="SESSION">
>> <cfloop index=List list="#SESSION.name#">
>> ...</cfloop>
>> </cflock>
>>
>>
>>
>>
>>
>>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to