Raymond Camden's  "Tips for CFMX-ifying your ColdFusion 5
Applications" 
(http://www.macromedia.com/devnet/mx/coldfusion/articles/updating_legacy.html)
discusses the need to only lock in case of race conditions.  If your
application uses *any* persistent scopes (client vars included) you
have to deal with the concept of a user opening up, for example, a
second window.  However a cflock will not help you in such a case. 
You'll get one set of writes from one window, and a corrupting set
from the second *perhaps*, but the solution to that won't come from
cflock.  This is something you'll have to assess when you look at your
app and what it does.

Its woth mentioning that, given the race-conditions-only proviso now
in effect for CFLOCK, and the fact that there is no longer any issue
with thread safety or server stability, you can consider whether or
not you want to ignore *benign* race conditions.  For example, if you
have the statement "You are visitor #application.thiscount# today" you
may well ask "who cares if the count is of by a couple?"  If the
answer is that it doesn't matter, you can skip locking the write and
reads of this variable.

A more realistic example would be your datasource access info.  The
name, username and password is commonly tossed in the application
scope.  It rarely changes if ever.  Same with stuff like paths.  In
turn these are often converted to the request scope so they can be
used without locking in for example a cfquery statement.  Here's
another example where you can set the vars once in the application
scope, not bother with a lock and use the application vars directly in
cfquery statements, without locking and dispensing with the conversion
to request vars.

Likewise if a user logs in and you are storing login and permission
information in a client scope rather than session, then that info
ports well into the session scope and can be used without locks,
assuming that the user isn't going to be switching permission levels
willy-nilly.

Search the archives here and you'll find a lot -- and I mean a LOT --
of information on this.

Cheers,

-- 
--mattRobertson--
Janitor, MSB Web Systems
mysecretbase.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:205992
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to