|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
ColdFusion MX and Locking
Hello all, I have had it stated to me that there is no need to use lockingBryan F. Hogan 05/22/03 09:52 A > Could someone explain to me the "truth".Massimo Foti 05/22/03 09:56 A Ah, and the truth be told. Great thanks Massimo!Bryan F. Hogan 05/22/03 10:00 A My only objection to this article is the statement that recommendationsRaymond Camden 05/22/03 10:09 A Does the same hold true with Session vars?Bryan F. Hogan 05/22/03 10:13 A I would say so. It depends on the usage. For example, if on login I doRaymond Camden 05/22/03 10:18 A I understand, thanks.Bryan F. Hogan 05/22/03 10:21 A Hello all, I have had it stated to me that there is no need to use locking in CFMX. And I have also heard that you only need to lock file and com access and not the shared scopes. And I have heard that it is required on both shared scopes and file/com access. Could someone explain to me the "truth". Thanks Bryan > Could someone explain to me the "truth". > You may try this: http://www.macromedia.com/support/coldfusion/ts/documents/tn18235.htm ---------------------------- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ---------------------------- Ah, and the truth be told. Great thanks Massimo! > Could someone explain to me the "truth". > You may try this: http://www.macromedia.com/support/coldfusion/ts/documents/tn18235.htm ---------------------------- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ---------------------------- My only objection to this article is the statement that recommendations from previous versions have not changed. While the article does describe race conditions and why you need to lock them, it makes it seem like the old rule ("ALWAYS LOCK OR YOU WILL DIE!" ;) is still true. This is simply not the case. If you are using Application vars, for example, as pseudo-constants: <cfif not isDefined("application.foo")> <cfset application.foo = 1> </cfif> <cfoutput>#application.foo#</cfoutput> There is no reason to lock these lines. ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email : jedimaster@mindseye.com Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more ----- http://www.macromedia.com/support/coldfusion/ts/documents/tn18235.htm ---------------------------- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ---------------------------- Does the same hold true with Session vars? My only objection to this article is the statement that recommendations from previous versions have not changed. While the article does describe race conditions and why you need to lock them, it makes it seem like the old rule ("ALWAYS LOCK OR YOU WILL DIE!" ;) is still true. This is simply not the case. If you are using Application vars, for example, as pseudo-constants: <cfif not isDefined("application.foo")> <cfset application.foo = 1> </cfif> <cfoutput>#application.foo#</cfoutput> There is no reason to lock these lines. ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email : jedimaster@mindseye.com Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more ----- http://www.macromedia.com/support/coldfusion/ts/documents/tn18235.htm ---------------------------- Massimo Foti Certified Dreamweaver MX Developer Certified Advanced ColdFusion MX Developer http://www.massimocorner.com/ ---------------------------- I would say so. It depends on the usage. For example, if on login I do session.name="foo" session.favmoviue="star wars" There is no reason to lock. However, and as you see in the article, when working with a variable where a race condition may occur, you would want to use locks. Another example: <cflock scope="session" type="exclusive" timeout=3> <cfset session.pageCount = session.pageCount+1> </cflock> As you can guess, this code keeps track of how many pages the user has viewed. If you are using MX, you make things a bit easier with a UDF: <cfset increasePageCount()> <cffunction name="increasePageCount" returnType="void" output="false"> <cflock etc .. </cflock> </cffunction> Although that _may_ be a bit of overkill. ;) ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email : jedimaster@mindseye.com Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more ----- I understand, thanks. I would say so. It depends on the usage. For example, if on login I do session.name="foo" session.favmoviue="star wars" There is no reason to lock. However, and as you see in the article, when working with a variable where a race condition may occur, you would want to use locks. Another example: <cflock scope="session" type="exclusive" timeout=3> <cfset session.pageCount = session.pageCount+1> </cflock> As you can guess, this code keeps track of how many pages the user has viewed. If you are using MX, you make things a bit easier with a UDF: <cfset increasePageCount()> <cffunction name="increasePageCount" returnType="void" output="false"> <cflock etc .. </cflock> </cffunction> Although that _may_ be a bit of overkill. ;) ======================================================================== === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc (www.mindseye.com) Member of Team Macromedia (http://www.macromedia.com/go/teammacromedia) Email : jedimaster@mindseye.com Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus "My ally is the Force, and a powerful ally it is." - Yoda ----- Excess quoted text cut - see Original Post for more -----
|
May 25, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||