Via: http://www.aspdotnetfaq.com/Faq/How-to-clear-your-ASP-NET-applications-Cache.aspx

    public void ClearApplicationCache()

    {

        List<string> keys = new List<string>();

 

        // retrieve application Cache enumerator

        IDictionaryEnumerator enumerator = Cache.GetEnumerator();

 

        // copy all keys that currently exist in Cache

        while (enumerator.MoveNext())

        {

            keys.Add(enumerator.Key.ToString());

        }

 

        // delete every key from cache

        for (int i = 0; i < keys.Count; i++)

        {

            Cache.Remove(keys[i]);

        }

    }

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

   
© 2012 SmatterChew Suffusion theme by Sayontan Sinha