June 2002
Intermediate to advanced
816 pages
28h 12m
English
Cache
HttpCache = Context.Cache
Returns an instance of the Cache class.
HttpCache
An Object variable of type Cache.
The example retrieves an instance of the Cache
class into a local variable and then adds a value to the cache:
Sub Application_BeginRequest( )
Dim myCache As Cache
myCache = Context.Cache
myCache.Add("Test", "Test", Nothing, _
System.DateTime.Now.AddHours(1), Nothing, _
CacheItemPriority.High, Nothing)
End SubNote that rather than using the Page_Load event, the example above
shows the Application_BeginRequest event handler in
global.asax; a common use of the Cache property
is to access the cache at points during request processing when the
Cache property of the Page object is not available, such as before
the Page object is instantiated.
Read now
Unlock full access