I've tested it on both applicationScope and sessionScope, and it doesn't seem to do any harm. After the maps are cleared, the server automatically loads the "internal" values used by the system.
function clearMap( map:Map ){
// Get iterator for the keys
var iterator = map.keySet().iterator();
// Remove all items
while( iterator.hasNext() ){
map.remove( iterator.next() );
}
}
Usage:clearMap( applicationScope )
Share and enjoy!
4 comments:
very neat
Very simple but effective code. In my applications I do the same for the sessionscope right before a user is logged out.
You can also use map.clear(); if you want to remove all values from the map.
map.clear() doesn't seem to do anything to the scope maps. I forgot to mention that in the blogpost..
Post a Comment