When you create your first ASP.NET MVC website, you are probably not too worried about performance. If you make a basic website, everything will run fast and smooth, thanks to all the effort that has been put into the framework. So you likely haven't given performance any thoughts, and that's fine, but as soon your website evolves into something more complex, improving the performance might become very relevant. An excellent place to start is caching.

When talking caching and websites, there are several ways of doing things, but it can generally be divided into two categories: Client-side caching and server-side caching, and even though ASP.NET is a server-side technology, it can help you utilize both types of caching.

As you may or may not know, your browser is likely already caching stuff for you on your website. It has a lot of mechanisms for fetching and storing resources which are normally static, like images and style-sheets (CSS), so that they don't have to be downloaded for each request made to your webserver. This is an example of client-side caching, since it's performed by the client (the browser), but you can actually accomplish the same type of caching for the actual content of your pages. We'll discuss this in one of the next articles, where we will be looking into the ResponseCache technique.

If you're looking for ways of caching stuff directly on the server, instead of on the client, you should be looking into topics like in-memory caching and output caching. We'll talk more about that as well in this chapter.

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!