Tips For Using Session And Application Variables; Getting A List Of Application And Session Variables; Default Variables And Constants - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

Chapter 12: Using the Application Framework
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
A data source you're using
A domain name
Style settings such as fonts or colors
Other important application-level variables
file. For example you may want to designate:
197

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents