.NET provides three primary forms of
caching:
page level output caching easy to implement
user control level output caching (or fragment caching) easy to implement
Using Cache Object More flexible throughout every layer of an
application
1. Page Level Output Caching
The simplest form of caching, output caching simply keeps a copy
of the HTML that was sent in response to
a request in memory. Subsequent
requests are then sent the cached output until the cache expires, resulting in
potentially very large performance gains (depending on how much effort was
required to create the original page output—sending cached output is always
very fast and fairly constant).
You have to give the duration in seconds for the page to be cached.
Implementation:
<%@ OutputCache Duration="60" VaryByParam="*" %>
This directive, as
with other page directives should appear at the top of the ASPX page, before
any output.
2. Fragment Caching, User
Control Output Caching
Often,
caching an entire page is not feasible, because certain parts of the page are
customized for the user.