Bud, You are correct that two different users will be able to access the lock simultaneously in my #CFID_#CFTOKEN# example, but that's okay because I was locking a Session variable. Each user has their own Session memory and we don't need to worry about user A writing in user B's memory space.
You are correct when talking about Application or Server variables. In those cases you definetely do not want to use CFID or CFTOKEN. You just need to use an appropriate lock name for each shared scope. The server scope needs to be specific to the entire server, Application scope for the specific application you are running, and the Session scope specific to each user. At least that's always been my understanding of cf locking. In your example below I believe you are actually locking at too high a level. You will have user A waiting on locks held by user B even though their sessions should be completely independant of one another. </rob> -----Original Message----- From: Bud [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 15, 2002 10:48 AM To: CF-Talk Subject: RE: CF4.0 shared scope locking? On 5/15/02, Rob Baxter penned: >You need to use the name attribute to specify a name unique to that locking >code. For example, for Session var locking I usually used <cflock >name="#CFID#_#CFTOKEN#" ...> I don't think that's going to work as user A will have a different cfid and cftoken than user B. This will allow them to both access the same exclusive lock simultaneously since they'll be named differently. I generally use the datasource name since I know it's unique to the server and append something for each different variable. <cfset request.dsn = "mydatasource"> To set a value in a variable named session.cart: <cflock name="#request.dsn#_basket" timeout="10" type="exclusive"> <cfset session.cart.product_id = #form.product_id#"> </cflock> To read session.cart: <cflock name="#request.dsn#_basket" timeout="10" type="readonly"> </cfoutput>#session.cart.product_id#</cfoutput> </cflock> -- Bud Schneehagen - Tropical Web Creations _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ ColdFusion Solutions / eCommerce Development [EMAIL PROTECTED] http://www.twcreations.com/ 954.721.3452 ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm 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