Login or Sign Up to become a member!

EXPERTS, INFORMATION, IDEAS & KNOWLEDGE

Social bookmarker Add this

ASP.NET: Clear all Cached objects

From Wiki

Jump to: navigation, search

Summary: An example of how to clear all cached objects

The Cache doesn't have a Clear method so you have to loop through each item and Remove each key:

  1. Dim CacheEnum As IDictionaryEnumerator = Cache.GetEnumerator
  2.  
  3. While CacheEnum.MoveNext  
  4.     Cache.Remove(CacheEnum.Key.ToString)  
  5. End While

This Hack is part of the ASP.NET Hacks collection

431 Rating: 3.0/5 (5 votes cast)