APPLICATION Variable Scope


APPLICATION Variable Scope

After you create an APPLICATION variable, it is immediately available to every page in your application. You can store simple variables or complex data types such as structures and arrays in it. Query record sets can also be stored in APPLICATION variables.

TIP

APPLICATION variables are great places to store queries that are used in many pages of your Web site. For instance, many forms that collect user information have a drop-down list of U.S. states. Querying the database every time you want to display this list can be a waste of valuable resources. Instead, write the query directly to the APPLICATION scope, and it will be stored in memory.

You will see an example of the code to put a query record set into the APPLICATION scope in the next section, "Creating APPLICATION Variables."


By default, APPLICATION variables are stored in the ColdFusion server's memory for two days. You can see and change the default and maximum time out for these variables by looking in ColdFusion Administrator. After you log into Administrator, look in the Server section at the top and find a link called Memory Variables. You may use this screen to set the default and maximum time-out values.

TIP

If you're worried about APPLICATION variables gobbling up all of your extra RAM, you can always turn them off using ColdFusion Administrator. On the Memory Variables page of ColdFusion Administrator, you will see a checkbox labeled Enable Application Variables. If you uncheck it, your developers will be restricted from using these variables.




Macromedia ColdFusion MX 7 Certified Developer Study Guide
Macromedia ColdFusion MX 7 Certified Developer Study Guide
ISBN: 0321330110
EAN: 2147483647
Year: 2004
Pages: 389
Authors: Ben Forta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net