Object Caching:
Caching objects provides more flexibility than other caching techniques. Use Caching objects to place any object in the cache. The object can be of any type - a type of data, a web control, a class, a DataSet object, etc.
The item is added to the cache by simply assigning a new key name. Like:
Cache["key"] = item;;
It also provides ASP.Net Insert method () to insert an object into the cache. This method has four versions of its capacity. Let's see the different versions first.
Use the time-limit to remove an item from the cache when not used for a specified period of time. The following code fragment stored element with a time-limit of 10 minutes with no dependencies.
Example:
Create a page with a GridView and a label. Type the following code in the page load event:
Output:When the page first loads it says:
If you click on the button again within 20 seconds, is publish the page again, but label control gets the information from the cache:
0 comments:
Post a Comment