Mark Smith

ASP.NET, SQL Server, HTML, CSS and other random thoughts!

November 2007 - Posts

Clear your cache

I've just created a site management section for one of my sites, and one of the pages allows you to clear certain elements from the cache. I wanted an option to remove all cached objects but it doesn't appear to have a clear method. A way around this is just to create a dictionary enumerator to loop through the cache and clear objects one at a time e.g.

        Dim CacheEnum As IDictionaryEnumerator = Cache.GetEnumerator
        While (CacheEnum.MoveNext)
            Cache.Remove(CacheEnum.Key.ToString)
        End While

 


 

Posted: Nov 16 2007, 10:32 AM by ca8msm | with 3 comment(s)
Filed under: ,
More Posts