Chapter 12: Using the Application Framework
197
You can set the time-out period for application variables within a specific application
(thereby overriding the default setting in the ColdFusion Administrator) by using the
APPLICATIONTIMEOUT attribute of the CFAPPLICATION tag.
If no clients access the application within the specified time-out period, ColdFusion
Server destroys its application variables.
Tips for Using Session and Application Variables
In general, session and application variables are designed to hold information that you
seldom write but read often. In most cases, the values of these variables are set once,
most often when an application is first started (Application variables) or the first time a
user begins using an application (Session variables). Then the values of these variables
will be referenced many times throughout the life of the application or the course of a
session.
When using application variables, keep in mind that these variables are shared by all
instances of an application that might be running on a server. Because of this sharing,
applications cannot assume that values saved in these variables will not be overwritten
by other instances of the same application that might be simultaneously running on
the server. Of course, this is not a problem if these variables are treated as "write-once,
read-many," but can be a problem if they are written to indiscriminately.
Getting a list of application and session variables
The variable scope names "application" and "session" are registered as ColdFusion
structures. This enables you to use the ColdFusion Structure functions to get a list of
application and session variables. For example, you can use CFLOOP with the
StructFind function to output a list of application and session variables defined for a
specific application.
To find a list of client variables, you use the GetClientList function.
See the CFML Language Reference for more information on these functions.
Default Variables and Constants
It is often useful to set default variables and application-level constants in the
Application.cfm
file. For example you may want to designate:
•
A data source you’re using
•
A domain name
•
Style settings such as fonts or colors
•
Other important application-level variables
Summary of Contents for COLDFUSION 4.5-DEVELOPING WEB
Page 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Page 14: ...xiv Developing Web Applications with ColdFusion...
Page 26: ...xxvi Developing Web Applications with ColdFusion...
Page 34: ...8 Developing Web Applications with ColdFusion...
Page 70: ...44 Developing Web Applications with ColdFusion...
Page 84: ...58 Developing Web Applications with ColdFusion...
Page 114: ...88 Developing Web Applications with ColdFusion...
Page 148: ...122 Developing Web Applications with ColdFusion...
Page 174: ...148 Developing Web Applications with ColdFusion...
Page 208: ...182 Developing Web Applications with ColdFusion...
Page 244: ...218 Developing Web Applications with ColdFusion...
Page 274: ...248 Developing Web Applications with ColdFusion...
Page 288: ...262 Developing Web Applications with ColdFusion...
Page 300: ...274 Developing Web Applications with ColdFusion...
Page 350: ...324 Developing Web Applications with ColdFusion...
Page 362: ...336 Developing Web Applications with ColdFusion...