Net-informations.com
SiteMap  | About    

ASP.NET Caching

Caching is the ability to store page output and data in memory for the first time it is requested and later we can quickly retrieve them for multiple, repetitious client requests. It is like keeping a copy of something for later use, so we can reduce the load factor on Web servers and database servers by implementing caching on a Web application.

vb.net

  Cache.Add("dataset", dataset, Nothing, System.Web.Caching.Cache.NoAbsoluteExpiration, New TimeSpan(0, 0, 60), System.Web.Caching.CacheItemPriority.[Default],Nothing)

C#

  Cache.Add("dataset", dataset, null, System.Web.Caching.Cache.NoAbsoluteExpiration, new TimeSpan(0, 0, 60), System.Web.Caching.CacheItemPriority.Default, null);

Retrieve data from cache

vb.net
  Dim ds as New DataSet

ds = CType(Cache("dataset"),DataSet)

C#
  DataSet ds = new DataSet();

ds = (DataSet) Cache["dataset"];

It becomes more efficient to serve a copy of the initial response, rather than regenerating the same response for every client request.

ASP.NET provides two types of caching, Application Cache and Page Output Cache. The application cache, which provides a programmatic way for you to store arbitrary data in memory using key/value pairs. The Page output caching, which saves the output of page processing and reuses the output instead of re-processing the page when a user requests the page again.






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.