JavaScript Editor jscript editor     Web designer 



Main Page

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:

For more information see ASP.NET Caching Overview.

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 How to: Add Items to the Cache. You can be notified when an item is removed from the cache. For more information see How to: Notify an Application When an Item Is Removed from the Cache.

In addition to allowing items to be removed from the cache automatically, you can explicitly remove them.

NoteNote

If you call the Insert method 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 the Remove method, passing the key of the item you want to remove.

    The following example shows how to remove an item with the key MyData1.

    Visual BasicВ CopyCode imageCopy Code
    Cache.Remove("MyData1")

    C#В CopyCode imageCopy Code
    Cache.Remove("MyData1");

See Also



JavaScript Editor jscript editor     Web designer