views:

187

answers:

3

Hi,

I have a asp.net web application and I'm using cache (HttpRuntime.Cache) to save some stuff from db.

I also update db from time to time so that data in db does not match the data in my application's cache.

Is there any way how to clear my application's cache without modifying any source code or republishing the page?

I tried to restart IIS and to clear browsers cache but nothing helps.

Please help.

+1  A: 

Create admin page for restarting your application and put

HttpRuntime.UnloadAppDomain();

to button_click or similar.

Mika Kolari
tnx for answer.
dani
+1  A: 

Restarting IIS will work - since the cache is kept in memory. If you're using SQL Server you can set up a cache dependency to automatically expire your cache when SQL Server is updated.

http://msdn.microsoft.com/en-us/library/ms178604.aspx

Paul Alexander
tnx for answer.
dani