//Use the below NameSpace for caching.
//In .NET data caching is main done using two classes in System.Web.Caching namespace namely "Cache" and "CacheDependency".
using System.Web.Caching;
string value="";
//Add and item to cache: To add an object in cache following syntax is used
//Explanation: Using the below syntax we can store the item in the cache.
//This entry will have no dependencies on it.
//Dependencies like it will not expire unless the cache engine removes it.
Cache["key"] = value;
//Explanation: The above syntax is used to retrieve the value form cache
value = (string)Cache.Get("key");
//Explanation: Above statement will remove the key cached object from cache
Cache.Remove("key");
No comments:
Post a Comment