User Guide

cfapplication 53
If you use this tag to activate the Application and Client scopes, ColdFusion saves the application
name as a key, whose maximum length is 64 characters. If an application name is longer than this,
the client store fails during database processing.
Note: The CFTOKEN variable is 8 bytes in length. Its range is 10000000 —99999999.If you
specify ClientStorage=cookie, any Client scope variables set following a cfflush tag are not
saved in the Client browser.
Example
<!--- This example shows how to use cflock to guarantee consistent data
updates to variables in Application, Server, and Session scopes. --->
<h3>cfapplication Example</h3>
<p>cfapplication defines scoping for a ColdFusion application and
enables or disables the storing of application and/or sessionvariables.
This tag is placed in a special file calledApplication.cfm that is run
before any other CF page in a directory where the Application.cfm file
appears.
<cfapplication name = "ETurtle"
sessionTimeout = #CreateTimeSpan(0, 0, 0, 60)#
sessionManagement = "Yes">
<!--- Initialize session and application variables used by E-Turtleneck.
Use session scope for session variables. --->
<cflock scope = "Session" timeout = "30" type = "Exclusive">
<cfif NOT IsDefined("session.size")>
<cfset session.size = "">
</cfif>
<cfif NOT IsDefined("session.color")>
<cfset session.color = "">
</cfif>
</cflock>
<!--- Use the application scope for the application variable. This variable
keeps track of total number of turtlenecks sold. --->
<cflock scope = "Application" timeout = "30" type = "Exclusive">
<cfif NOT IsDefined("application.number")>
<cfset application.number = 1>
</cfif>
</cflock>
<cflock scope = "Application" timeout = "30" type = "readOnly">
<cfoutput>
E-Turtleneck is proud to say that we have sold #application.number#
turtlenecks to date.
</cfoutput>
</cflock>
<!--- End of Application.cfm --->