Maintaining State with the Cache Object
A new option for maintaining state in ASP.NET is caching of data with the Cache object.
The Cache object works in a similar way to the other state management objects covered in this chapter in that it too stores data in key-value pairs. The Cache object closely resembles the Application object because state can be maintained throughout the life of the application and is private to each application. The downside is that any data stored there will be lost if the application is recycled.
The following syntax can be used in a regular ASP.NET page to store data in the Cache object:
Cache("Key") = Value
The following syntax can be used in a regular ASP.NET page to retrieve data from the Cache object:
Value ...
Get Creating and Consuming Web Services in Visual Basic® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.