> Forgive my stupidity, but once I lock the session.cart, I 
> shouldnt have to lock every reference to it. correct?

No need to claim stupidity - there's a lot of misunderstanding about locking
to go around.

The answer, though, is "it depends". If you've got several references like
this:

<cfset session.cart.foo = "val1">
<cfset session.cart.bar = "val2">

you could wrap them within a single CFLOCK with a TYPE="EXCLUSIVE"
attribute. On the other hand, if you've got references to Session.cart
spread all over your code, you'll need locks spread all over your code.
Locking in CF is a cooperative venture - it's not enough to lock one
reference, because if another reference is unlocked, CF won't know to check
for an existing lock.

In many ways, locking in CF is similar to locking within a database. For
example, you might have a transaction which create locks and respect the
locks of others, but if you then write another transaction which
intentionally disregards locks, the first one won't be able to lock out the
second.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to