here you go, it was given to me Monday from this list....dave whiterod I
think ;)

You may find the following link useful:

ColdFusion Server (Versions 5 and Prior): ColdFusion Locking Best
Practices

TechNote 20370
http://www.macromedia.com/v1/handlers/index.cfm?ID=20370&Method=Full


also, from dave watts....

The thought process is very simple. If you're running CF 5 or earlier,
and
you're using session variables, and you don't lock them, bad things will
happen. Memory variables can be accessed by concurrent requests, and CF
doesn't handle that well, by default. While you might not think session
variables would be used by concurrent requests, there are many possible
cases in which more than one request from the same user might be running
concurrently.

> any good books on that topic?

A book would be overkill, just for this topic. If you're using CF 5 or
earlier, just follow these simple rules:

1. Dvery time you put "Session", "Application" or "Server" in your code,
use
CFLOCK around it.

2. If you're using any version of CF which supports the SCOPE attribute
(4.5+, I think), use that with your CFLOCK tags around memory variables.

3. If you're reading a memory variable, use TYPE="READONLY" in your
CFLOCK;
if you may change the variable's value, use TYPE="EXCLUSIVE".

4. There is no rule 4.

5. Reread rule 1.



..tony

Tony Weeg
Senior Web Developer
Information System Design
Navtrak, Inc.
Fleet Management Solutions
www.navtrak.net
410.548.2337 


-----Original Message-----
From: Pablo Nevares [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, September 24, 2002 2:56 PM
To: CF-Talk
Subject: variable locking and transactions


I've been looking up information on cflock and cftransaction lately, I'm
sad
to say that I haven't had any experience using them in the past. Am I
correct in saying that as a best practice cflock should always be used
when
you're accessing or modifying variables in Session, Application, or
Server
scopes? And you use the ReadOnly type when you're only going to access
the
variable, and exclusive when there's any chance it'll be modified?

I'm a little more confused about cftransaction. I understand that you
can
either commit or rollback queries with it, but is this also how you lock
databases? If I don't want two people inserting new records into the
database at once, would I just do a normal cftransaction with a commit
at
the end? Thanks in advance for any help.

Pablo Nevares
[EMAIL PROTECTED]


______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
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

Reply via email to