Macromedia coldfusion 4.5-cfml language reference User Manual

Page of 608
126
CFML Language Reference 
2.
Lock the application scope. In the CFLOCK tag, indicate scope by 
specifying "APPLICATION" as the value of the SCOPE attribute.
3.
Lock the server scope. In the CFLOCK tag, indicate the scope by specifying 
"SERVER" as the value of the SCOPE attribute.
4.
Unlock the server scope.
5.
Unlock the application scope.
6.
Unlock the session scope.
Note
You can take out any pair of lock/unlock steps if you do not need to lock a 
particular scope. For example, you can take out Steps 3 and 4 if you do 
not need to lock the server scope. Similar rules apply for named locks.
For complete usage information on CFLOCK, see Developing Web Applications with 
ColdFusion
.
Example
<!------------------------------------------------------------- 
    This example shows how CFLOCK can be used to guarantee the
    consistency of data updates to variables in the Application, 
Server, and Session scopes.
You should copy the following code into an Application.cfm
    file in the snippets directory. 
--------------------------------------------------------------->
<HTML>
<HEAD>
<TITLE>Define Session and Application Variables</TITLE>
</HEAD>
<BASEFONT FACE="Arial, Helvetica" SIZE=2>
<BODY  bgcolor="#FFFFD5">
<H3>CFAPPLICATION Example</H3>
<P>CFAPPLICATION defines scoping for a ColdFusion application and 
enables or disables the storing of application and/or session
variables. This tag is placed in a special file called
Application.cfm that is run before any other CF template in a
directory where the Application.cfm file appears.</P>
<CFAPPLICATION NAME="ETurtle" SESSIONTIMEOUT=#CreateTimeSpan(0, 0, 
  0, 60)# SESSIONMANAGEMENT="yes">
<!---------------------------------------------------------------------- 
Initialize the session and application variables that will be 
used by E-Turtleneck. Use the session scope for the session 
variables. 
-----------------------------------------------------------------------> 
<CFLOCK SCOPE="Session" TIMEOUT="30" TYPE="Exclusive">
<CFIF NOT IsDefined("session.size")>
<CFSET session.size = "">
</CFIF>