Data caching is carried out manually in your code.In data caching,you store important pieces of information that are time consuming to reconstruct such as dataset retreived from a database.
ASP.NET Provides 3 methods to store data or objects into the cache.
Adding :
Cache["Item"] = "Some string data";
Cache.Add("Item", "Some data", null, Cache.NoAbsoluteExpiration, System.TimeSpan.FromMinutes(1), CacheItemPriority.Default, null);
Cache.Insert("Item", "Some data");
Getting:
if(Cache["Item"] != null)
String str = Cache["Item"] .ToString();
Remove:
Cache.Remove("Item");
No comments:
Post a Comment