Baz,

Think this through.... locking the "session" scope locks "THIS" session, so
you are really keeping the user from interfering with himself.  In a sense,
using named locks for session scope may be overkill unless you have some
kind of polling or long running scripts, or perhaps you are setting or
updating the same variable constantly - in that case a named locke would be
a good choice I think.

Locking the Application scope does indeed lock it "for everyone", but the
Application scope is usually used in a "write once read many" fashion.  I do
not typically lock reads anymore for that scope - just writes.... so if I'm
writing to the scope once (with a scope lock) and then reading from it,
there's no real penalty there that I can see.

In addition, the "Application.cfc" approach negates the need to add specific
locks because I can now use the "onApplicationStart( )" script to set up my
variables.

The Exception in the case of the application variable is a "counter" or
"tracking" variable that is updated regularly - tracking logged in users for
example. In that case a named lock would keep you from locking the entire
scope and make perfect sense.

That's my take.

-Mark


-----Original Message-----
From: Baz [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 10, 2006 7:21 AM
To: CF-Talk
Subject: good old CFLOCK question


I know locking questions have come up before... but it's a quickie...

Is there ever a reason to lock an entire scope instead of using named locks?
It seems that locking an entire scope just causes extreme inefficiency
without any advantages...

Thanks,
Baz







~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:229013
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