User Guide

230 Chapter 12 Using the Application Framework
Getting a list of Session variables
The variable Session scope is registered as a ColdFusion structure. This lets you use
the ColdFusion Structure functions to get a list of Session variables. For example, you
can use
cfloop with the StructFind function to output a list of Session variables
defined for a specific application.
To find a list of Client variables, you use the GetClientVariablesList function.
For more information on these functions, see the CFML Reference.
Using Application Variables
Application variables are available to all pages within an application, that is, pages
that have the same application name. Because they are persistent, you can pass
values between pages with a minimum of effort.
You set the application name in the
cfapplication tag, normally on your
applications Application.cfm page. The name you establish in the
cfapplication
tag is accessible elsewhere in the application by using the
Application.ApplicationName variable. For example, you use this variable in the
cflock tag to restrict access to Application variables to one request at a time.
Unlike Client and Session variables, Application variables do not require that a client
name (client ID) is associated with them. Thus, they are available to any clients that
specify the same application name. Also, you do not need to use the
cfapplication
tag to enable Application variables. Using the ColdFusion Administrator you can
enable or disable Application variables in all applications; you cannot override this
setting for an individual application.
Like Session variables, ColdFusion stores Application variables in the ColdFusion
Servers memory and you can set timeout values for these variables either with
cfapplication, or by specifying timeouts in the ColdFusion Administrator.
For information on setting timeouts for variables, see Advanced ColdFusion
Administration.
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 which client is running that application. Using Application variables, an
application could initialize itself, say, when the first user access any page of that
application. This information can 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 either a specific period of inactivity passes or
the ColdFusion Server shuts down, Application variables are very convenient.
However, because all clients running an application see the same set of Application