In my opinion, only use CFLock when you care if the race condition matters.
Take setting SESSION values for instance. Let's say you have the following
code:

<cfset SESSION.FirstName = qUser.first_name />

This would NOT require a lock. Yes, it's shared data. Yes you could have
conflicts. But the question is, does it matter? If a user has two pages that
happen to run this code simultaneously, is there going to be a bad outcome
if no locking? NOOOO. Both will set the appropriate value. 

Then take a session counter in the application:

<cfset APPLICATION.SessionCount = ( APPLICATION.SessionCount + 1 ) />

Again, you are updating shared memory... But again, does it matter? Can this
ever fire in such a way where it will get hurt? No. No matter what, sessions
are going to be added.

So the questions you need to ask yourself in this order are:

1. Is there a race condition?

2. Does the race condition matter?

.......................
Ben Nadel 
www.bennadel.com
Certified Advanced ColdFusion Developer

Need Help?
www.bennadel.com/ask-ben/


-----Original Message-----
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 06, 2006 6:20 PM
To: CF-Talk
Subject: Locking Theory

Okay.. so, is cflock in or out these days?

Should I be using cflock around session variable reads?  writes?

If so, why?

Rick



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:252297
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to