How to Reset Application Variables for ColdFusion
Application session variables span the entire scope of your Web project in ColdFusion. The session variables are not cleared until the session timeout value is reached or you manually clear the session in your ColdFusion app. You can manually clear app variables using the "StructClear" function, which clears all variables for a user's session, so you can log out the user or clear saved settings.
Instructions
-
-
1
Open your ColdFusion editor from the "Adobe" Windows program menu group. Open your Web application and the file you want to use to clear the variables.
-
2
Create the "cflock" tag. The cflock tag contains the timeout for the session. When the timeout value is reached, ColdFusion runs any functions you define. The following code defines the cflock tag:
<cflock scope="Scope" timeout="10" type="exclusive">
</cflock>
In this example, the timeout is set at 10 seconds.
-
-
3
Add the function to clear the variable values. The following code resets the session variables:
<cflock scope="Scope" timeout="10" type="exclusive">
<cfscript>
StructClear(Session);
</cfscript>
</cflock>
-
1