Has anyone put together a FAQ about CFLOCK that would show examples and best
practices? There are a lot of great optimization tips floating around, and
I'd love to find a single source that covers most of them. Things like you
just mentioned, such as copying the session to the request scope, and other
things like copying a session to a local variable before using it, etc.
Also, I'm still a little unclear on the way the locks work. If I lock a
relatively large portion of a page, what are the implications for
performance? Does that mean that no other browsers can access that page?
If the lock is read-only, I'd assume that anyone could access it at the same
time. If it's exclusive, is it completely unavailable for other sessions?
TIA!
Jeff
-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: Sunday, July 30, 2000 10:10 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: A couple more cflock question
> Hi once again. I'm about to start going back (grrrr) and locking all
> my session, application variables, etc properly. Got a couple
> question.
>
> 1. Suppose I'm creations a session variable FROM session variables.
> For instance:
>
> I have: session.subtotal, session.tax, and session.shipping. I want
> to create a total:
>
> <cfset session.total = session.subtotal + session.tax +
> session.shipping>
>
> What kind of lock would go around that? Or would it be best to set a
> local variable inside a Readonly lock then set the session.total
> inside an exclusive lock from the local variable.
Just one TYPE="EXCLUSIVE" lock will do just fine for this. You don't want to
make things more complicated than they need to be.
> 2. I've got a million instances of passing cfid and cftoken as
> session.id if cookies are turned off as per Ben Forta's examples in
> his book.
>
> a href = "somepage.cfm?#session.id#"
>
> That means I need to put a readonly lock around all of those,
> correct? My question is (actually a two part question).
>
> If I have a block of these, such as a text menu, should I put one
> lock around the entire block? Or should I lock each link separately?
If they're all together, you're probably better off locking them all within
one lock.
> Part B of this question: Since I'm going through the hassle of
> checking for the existence of cookies, AND passing the session.id,
> would it be better to just pass
> cfid=#client.cfid#&cftoken=#client.cftoken# and not worry about if
> cookies are turned on? I suppose even if I do that, I should put a
> readonly lock around the links anyway, huh?
The Client scope doesn't need to be locked. You might consider copying any
session data that you absolutely know you're going to need on each page to
the Request scope; you can do this in application.cfm, and then you don't
have to worry about sprinkling CFLOCKs throughout your pages - you'd just
change the scope of the affected variables.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.