Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a web site IIS 6.0 that places data into the cache. Sadly it hasn't had a expiration set on it. Is there a way (utility or command) to force this cache to be cleared without rebooting the machine or restarting the web server?

I've already tried restarting the application pool without success.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

I use iisreset from command line but this restarts the IIS admin service and all dependent services. Which my not be to your liking.

However, it cleanly clears all cache, App Pools and .net cache too.

share|improve this answer

You can do it with some ASP.NET code:

foreach(DictionaryEntry entry in System.Web.HttpContext.Current.Cache) {
    System.Web.HttpContext.Current.Cache.Remove((string)entry.Key);
}
share|improve this answer

Can I ask why an iisreset isn't possible? The few seconds that it takes shouldn't be noticeable to your end-users. You could schedule it for a quiet period of the day to have the least affect.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.