Using Application Variables; Storing Application Data In Application Variables; Application Variable Time-Outs - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

196
to be triggered on every page --->
<CFSET MainPage = "default.cfm">
<CFSET session.current_location = "Davis, Porter, Alewife">
<CFSET sm_location = "dpa">
<CFSET current_page = "#cgi.path_info#?#cgi.query_string#">

Using Application Variables

Application variables require an application name be associated with them and are
always scoped within that application name.
Unlike client and session variables, however, application variables do not require that
a client name (client ID) be associated with them. Thus, they are available to any
clients that specify the same application name.
The name you establish in the CFAPPLICATION tag is accessible elsewhere in the
application by using the Application.ApplicationName variable. For example, you
would use this variable in the CFLOCK tag to restrict access to application variables to
one request at a time.

Storing application data in application variables

Application variables are designed to store application-level data. They are a
convenient place to store information that all pages of your application might need no
matter who (what client) is running that application. Using application variables, an
application could initialize itself, say, when the first user hit any page of that
application. This information could then remain available indefinitely to all
subsequent hits of any pages of that application, by all users, thereby avoiding the
overhead of repeated initialization.
Because the data stored in application variables is available to all pages of an
application and remains available until ColdFusion Server is shut down, application
variables are very convenient. However, because all clients running an application see
the same set of application variables, they are not useful for client-specific
information. To target variables for specific clients, use session variables.

Application variable time-outs

Application variables have a specific lifetime, and this lifetime defines an
"application." For example, when you access an application variable inside a specific
application, the variable returns a value because your request occurs on a page
declared in the CFAPPLICATION tag to be part of a single application.
The default time-out period for application variables is two days. In the Variables page
of the ColdFusion Administrator, you can define time-out values for application and
session variables. See Administering ColdFusion Server for more information.
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents