The ASP.Net platform brought forth many new features and enhancements over the former ASP platform. One of the more significant to be introduced was caching. Previously managed by third-party components, ASP.Net came packed with rich caching options, out of the box. Regardless of whether or not your application is already built and running, it can only benefit from the proper use of caching. This article will explain the various options we have, which will in turn lead to faster applications, and therefore more satisfied users, which can only be a good thing!
How Caching Means More Ca-ching, Part 1 - Call The HttpCachePolicy! (Page 3 of 4 )
If you want to use full page caching, but find the aforementioned methods insufficient for your needs, you may resort to using the far more granular HttpCachePolicy class. We do this in the fairly fool-proof manner of typing Response.Cache.[option]
There is the simple option by which we set the expiration time: Response.Cache.SetExpires( DateTime.Now.AddSeconds( 600 ) ) this is precisely the same as what we did already. We can also set the 'cacheability' which determines who or what can cache this page. We set this option like this:
NoCache The entire page or specified fields are not cached and must be re-requested.
Server The page is cached on the web server.
Public The page is cached on the client machine or shared (public) cache, such as a proxy server.
Private The page is cached on the client machine only. This is the default.
So this is the simplest form of caching provided by ASP.Net. It is not suitable for all situations, but where you are able to use it, you will notice large performance gains. Now let's move on to the next form, fragment caching.