How to: Delete Items from the Cache in ASP.NET
Data in the ASP.NET cache is volatile — that is, it is not permanently stored. It might be automatically removed from the cache for one of these reasons:
Because the cache is full.
Because the item has expired.
Because an item it is dependent on changes.
For more information see.
The specific method for removing items from the cache is determined in the code used to add the item to the cache. For more information, see. You can be notified when an item is removed from the cache. For more information see .
In addition to allowing items to be removed from the cache automatically, you can explicitly remove them.
If you call themethod and add an item to the cache with the same name as an existing item, the old item will be deleted from the cache.
To delete an item from the cache explicitly
Call themethod, passing the key of the item you want to remove.
The following example shows how to remove an item with the key MyData1.