|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Global.asa clearing application variables
What is the difference between this function
function Application_OnStart() { Application.lock(); Application.contents.removeAll(); Application.staticObjects('cache').item('content')= {}; Application.staticObjects('cache').item('component')= {}; Application.staticObjects('users').item('loggedin')= {}; Application.staticObjects('users').item('notloggedin')= {}; Application.unlock(); } AND THIS FUNCTION : function Application_OnStart() { Application.contents.removeAll(); Application.lock(); Application.staticObjects('cache').item('content')= {}; Application.staticObjects('cache').item('component')= {}; Application.staticObjects('users').item('loggedin')= {}; Application.staticObjects('users').item('notloggedin')= {}; Application.unlock(); } The Removeall functions appears before the lock function. I feel it will clear all the application variables from the memory more effectively in the second case than the first. All suggestions are welcome.... Thank you Ankush |
|
#2
|
|||
|
|||
|
Application.lock gives your code exclusive use of the Application object until you unlock. Locking prior to editing or removing nodes would be my recommendation, this will prevent another user from adding/changing any application variables during your code execution.
|
|
#3
|
|||
|
|||
|
Global.asa
I feel using the function application. removeall() can be used prior to the application.lock(), since I want to clear all previous application variables, if there are any left, as soon as the application starts. But the individual variables can be removed after the application.lock(). Am I taking the right approach?
Can you give me a sample global.asa file code and usage of application.removeall() function.. Ankush |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Global.asa clearing application variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|