Contents > Developing ColdFusion MX Applications > Using Persistent Data and Locking > Configuring and using application variables > Using application variables PreviousNext

Using application variables

Generally, application variables should hold information that you write infrequently. In most cases, the values of these variables are set once, most often when an application first starts. Then the values of these variables are referenced many times throughout the life of the application or the course of a session.

To preserve data integrity, you must put all code that writes to Application scope variables or reads Application scope variables with data that can change inside cflock tags.

Because each Application scope variable is shared in memory by all requests in the application, these variables can become bottlenecks if used inappropriately. Whenever a request is reading or writing an Application scope variable, any other requests that use the variable must wait until the code accessing the variable completes. This problem is increased by the processing time required for locking. If many users access the application simultaneously and you use Application scope variables extensively, your application performance might degrade. If your application uses many application variables, consider whether the variables must be in the Application scope or whether they can be Session or Request scope variables.

The application scope has one built-in variable, Application.applicationName, which contains the application name you specify in the cfapplication tag.

You access and manipulate application variables the same way you use session variables, except that you use the variable prefix Application, not Session, and specify Session as the lock scope. For examples of using session variables see Creating and deleting session variables and Accessing and changing session variables.

For information on locking write-once read-many application variables efficiently, see Locking application variables efficiently


Contents > Developing ColdFusion MX Applications > Using Persistent Data and Locking > Configuring and using application variables > Using application variables PreviousNext

ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.