O'Reilly logo

ASP.NET Site Performance Secrets by Matt Perdeck

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Data caching

Data caching is aimed at caching individual objects using code in your code behind, rather than caching pages or user controls via page directives. It lets you store key-value pairs in cache on the server. These pairs are then accessible for all requests to the same website. However, as you saw in the section about output caching, if you have a web farm with multiple servers, each server has access only to its own cache. It is very flexible—you can specify expiry times, priorities, and dependencies on other items such as files or database objects.

We'll discuss more advanced topics such as database dependencies in a moment; first, let's see how to introduce data caching in your code.

Basic use

As you saw, you access the cache as a dictionary. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required