The Cache State
The ASP.NET Cache has the same scope of Application, meaning that both can be accessed by all page requests. The primary difference is that Cache enables holding information in memory, which avoids the need of re-creating and retrieving objects. This is good if you want to maintain updatable objects but could cause overhead (always considering that the bigger the amount of data to transfer is, the lower is the performance) because it requires memory, so it should be used when actually needed or when you ensure that performance is acceptable. The following is an example of storing and retrieving information with Cache:
Cache("MyUpdatableDataKey") = "My updatable data" Dim myUpdatableData As String = CStr(Cache("MyUpdatableDataKey")) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access