One of the new features in ASP.NET is a system for caching page and application data, so that you don’t have to perform the same expensive process every time someone views a page.
Page caching: Page caching: Caching can be performed on a per-page basis, or on a per-user-control basis, letting you store part or whole pages in a cache, and customise their expiration.
Page caching is controlled by the <%@ OutputCache %> directive
Object caching: You can insert a value into the Cache object giving it a unique key and set its absolute or relative expiration time.
XmlDataDocument x = null;
if (Cache["xmldata"] == null) {
x = ComplexProcess();
Cache.Insert("xmldata", x, null, DateTime.MaxValue,
TimeSpan.FromHours(12), CacheItemPriority.High, null);
} else {
x = Cache["xmldata"];
}
2006-07-23 21:43:37
·
answer #1
·
answered by Friend 2
·
0⤊
0⤋
You'll need to be more specific. Is there a particular cache you're asking about? Or caching in a particular context?
2006-07-24 02:24:12
·
answer #2
·
answered by Ryan 4
·
0⤊
0⤋