Last post Mar 10, 2011 01:59 AM by KumarHarsh
Mar 04, 2011 01:00 AM|vernonmechery|LINK
I have a webpage which displays some data along with a banner. The banner image is stored in the database with parameters "Pagename" and "form".
The application has been coded in such a way that when the page loads , a function checks for the banner in cache memory first with the parameters "pagename" and "form". It the banner does not exist, the new banner is retrieved from the database and is added
to the cache memory. Next time when the same page is called, the banner is displayed from the cache memory avoiding the DB to be hit everything to get the banner.
Now, I do not want a specific banner to be displayed on the page. I have removed that banner from the DB but the banner still gets displayed as this banner is still there in the cache memory.
Is there any way to delete the banner which exists in cache memory without making any code changes? Any help to resolve this issue would be really appreciated.
Thanks in advance,
Mar 04, 2011 01:55 AM|fayaz_3e|LINK
If you want temporary solution, do reset iis by iisreset directly in run prompt or command prompt. For permamnent solution add cache dependency.
Mar 04, 2011 05:59 AM|Dave Sussman|LINK
I use iisreset all the time locally to clear cache items when testing. If you're using the VS web server you can just stop it and re-run the application.
For a programmatic approach you can just set the cache entry to null.
Mar 07, 2011 05:27 AM|sirdneo|LINK
You can create a page named clearcache.aspx and in that page write following code:-
protected void Page_Load(object sender, EventArgs e)
List<string> keyList = new List<string>();
IDictionaryEnumerator CacheEnum = HttpContext.Current.Cache.GetEnumerator();
cacheKey = CacheEnum.Key.ToString();
foreach (string key in keyList)
Response.Write("Cache NOT Cleared");
Mar 08, 2011 01:53 AM|bala.sekhar|LINK
If i understood your problem correctly you have a Table in DB in which data will be changed. And same data is Cached in memory. Now you want the cache to reflect the changes that were done to the DB. If this is what you are looking for then SQL Cache
Dependency should resolve your problem. This article briefs how to implment SQL Cache Dependency:
Mar 10, 2011 01:59 AM|KumarHarsh|LINK
i hv put this in logout.any problem ?