On Sunday, July 13, 2003, at 01:45 PM, Dina Hess wrote:

> How can I programmatically refresh application-scoped variables 
> whenever there's a change?

DRK 3 contains the "init" tag, which is designed to be used in your 
Application.cfm file like this:

<cf_init>
        <cfset myVar = "myValue"/>
</cf_init>

The body of the init tag will only run the first time it is 
encountered.  All subsequent requests will not evaluate the body of the 
tag, unless the URL variable "flushinit" is equal to "true".  To 
refresh your application variables, therefore, simply append 
"flushinit=true" to any request.

Any init tag will only be evaluated once anywhere it is encountered in 
your application, so you can specify a "name" attribute so that you can 
use multiple init tags in a single application.  Locking is 
automatically handled in a way that protects your variables, but does 
not synchronize your entire application.

I like using the init tag because I often do more to initialize an 
application than just set some variables.  I may run some database 
queries or parse an XML file -- operations you would not want to 
perform on every request.

Christian

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to