Here are a couple of reasons I gave in response to a similar question
some weeks ago:
-- The Cache is thread-safe (uses ReaderWriterLocks).
-- Cache entries can expire, can have scavenging priorities, can have
dependencies which may force them to be removed from the Cache, and the
Cache notifies you in case an entry is removed.
-- The Cache automatically scavenges entries if their lifetime has
expired or memory is low, thus is somewhat self-tuning.
Because the cache engine is optimised to work with cached objects, and can
interact directly with IIS's own caching elements to provide enhanced speed
improvements, at an object, fragment or page level..
It also has the advantage or automatically flushing based on criteria
changing, like the source of the cahced information (a file for example)
changing - you would have to code all of this around the access to your
global variable.
--
Regards
John
vbMental said:
Why not just create a class level variable in the global.asax code-behind
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.