What Does the OutputCache Directive Do on the Client?

This was a question that was raised in my Front-End Performance presentation yesterday and I honestly did not know. So I came home last night and did a quick test by setting an OutputDirective on a page for 60 seconds.

<%@ OutputCache Duration="60" VaryByParam="*" %>

The result was an Expires Header is set to the client. You can see the result in the screenshot from FireBug. In FireBug this is indicated in the Cache-Control line of the Response Headers section.

This makes sense because you would want the browser to know when to come back and check for a newer version of the page. So not only does ASP.NET cache the resultant page in memory on the server, it lets the browser know when to come back for a newer version. This means your page will render super fast, or at least as fast as possible for each client.

Share This Article With Your Friends!