Clearing The Application Scope
ColdFusion
If you are working with another developer on a common development server, there will most likely come a time where one or the other developer needs to restart the application server in order to clear some Application scoped variables.
A cool trick to avoid that inconvenience, is to add something like this to your Application.cfc(or .cfm, or even index.cfm if you are using a MVC framework).
Then you can just pass ?killApplication as a query string in your url and clear that pesky Application scope.
A cool trick to avoid that inconvenience, is to add something like this to your Application.cfc(or .cfm, or even index.cfm if you are using a MVC framework).
<!--- Check to see if we should kill the current application --->
<cfif structKeyExists(url,"killApplication")>
<cfset theList = structKeyList(application,",")>
<cflock name="#application.applicationname#_reload" timeout="30" type="exclusive">
<cfloop from=1 to=#Listlen(theList)# index=i>
<cfif listGetAt(theList,i) NEQ "applicationname">
<cfset structDelete(application,listGetAt(theList,i)) />
</cfif>
</cfloop>
</cflock>
</cfif>
Then you can just pass ?killApplication as a query string in your url and clear that pesky Application scope.




Loading....