Caching is a technique to store the page data, parts of the page, items and data objects in memory when first time requested so that same data will be available to other users. It improves application performance. Caching can be done in the following ways,
<%@ OutputCache Duration="60" VaryByParam="none" %>
In the above syntax, the page will be cached for 60 seconds. After that if some one accesses the page again, that page will be cached in to memory.
<%@ OutputCache Duration="60" VaryByControl="SbHeader" %>
In the above syntax, the SbHeader user control will be cached for 60 seconds. After that if some one accesses that user control through a page again, that user control will be cached in to memory.
Cache.Insert("Users", dsUsers,newSystem.Web.Caching.CacheDependency(Server.MapPath("sb.xml")) , DateTime.Now.AddSeconds(60),TimeSpan.Zero