122
CFML Language Reference
CFLOCK
The CFLOCK tag provides two types of locks to ensure the integrity of shared data:
•
exclusive lock
•
read-only lock
An exclusive lock single-threads access to the CFML constructs in its body. Single-
threaded access implies that the body of the tag can be executed by at most one
request at a time. A request executing inside a CFLOCK tag has an "exclusive lock" on
the tag. No other requests are allowed to start executing inside the tag while a request
has an exclusive lock. ColdFusion issues exclusive locks on a first-come, first-served
basis.
A read-only lock allows multiple requests to access the CFML constructs inside its
body concurrently. Therefore, read-only locks should only be used when the shared
data will only be read and not modified. If another request already has an exclusive
lock on the shared data, the request will wait for the exclusive lock to be released
before it can obtain it.
Syntax
<CFLOCK
TIMEOUT="timeout in seconds "
SCOPE="Application" or "Server" or "Session"
NAME="lockname"
THROWONTIMEOUT="Yes/No"
TYPE= "ReadOnly/Exclusive ">
<!--- CFML to be synchronized --->
</CFLOCK>
TIMEOUT
Required. Specifies the maximum amount of time in seconds to wait to obtain an
lock. If a lock can be obtained within the specified period, execution will continue
inside the body of the tag. Otherwise, the behavior depends on the value of the
THROWONTIMEOUT attribute.
SCOPE
Optional. Specifies the scope as one of the following: Application, Server, or
Session. This attribute is mutually exclusive with the NAME attribute. See the
Scope section for valuable information.
NAME
Optional. Specifies the name of the lock. Only one request will be able to execute
inside a CFLOCK tag with a given name. Therefore, providing the NAME attribute
allows for synchronizing access to the same resources from different parts of an
application. Lock names are global to a ColdFusion server. They are shared
between applications and user sessions, but not across clustered servers. This
attribute is mutually exclusive with the SCOPE attribute. Therefore, do not specify
the SCOPE attribute and the NAME attribute in the same tag. Note that the value
of NAME cannot be an empty string.
Summary of Contents for COLDFUSION 4.5-CFML LANGUAGE
Page 1: ...Allaire Corporation CFML Language Reference ColdFusion 4 5...
Page 207: ...Chapter 1 ColdFusion Tags 183 CFCATCH CFTRY BODY HTML...
Page 224: ...200 CFMLLanguageReference CFOUTPUT P Text within CFOUTPUT is always shown CFOUTPUT BODY HTML...
Page 336: ...312 CFMLLanguageReference CFIF BODY HTML...
Page 404: ...380 CFMLLanguageReference DE It is morning CFOUTPUT P BODY HTML...
Page 413: ...Chapter 2 ColdFusion Functions 389 Customer BalanceDue BR CFOUTPUT CFIF BODY HTML...
Page 483: ...Chapter 2 ColdFusion Functions 459 CFOUTPUT CFLOOP BODY HTML...
Page 584: ...560 CFMLLanguageReference...
Page 594: ...570 CFMLLanguageReference...