Solved

Delete ALL cache items

Posted on 2004-09-15
7
331 Views
Last Modified: 2010-05-18
Is there a way to delete all items in the cache by iterating its keys collection as opposed having to know the specific name of the cache key you want to remove?
0
Comment
Question by:jonnyboy69
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:zulu_11
ID: 12063250
simply disable the Cache..use

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Zulu
0
 
LVL 20

Accepted Solution

by:
ihenry earned 125 total points
ID: 12065004
Try this,

Cache["one"] = "onerr";
Cache["two"] = "tworr";

foreach ( object o in Cache )
{
      DictionaryEntry e = o as DictionaryEntry;
      Cache.Remove(e.Key);
}
0
 

Author Comment

by:jonnyboy69
ID: 12065300
Fraid not, this is todo with client side caching, I'm talking about cached objects on the server
e.g. HttpContext.Current.Cache["DataSet"]
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jonnyboy69
ID: 12065495
I've now sorted this one thanks to google. Here is the solution in case anyone else is interested:

Objects are stored in cache as dictionary items (Cache implements iDictionary).
foreach(DictionaryEntry di in Cache)
{
Cache.Remove(di.Key.ToString());
}
Courtesy of: http://www.miseldine.com/post/1161.aspx
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12065519
so what's wrong with my suggestion...
0
 
LVL 20

Expert Comment

by:ihenry
ID: 12065614
what my code is doing exactly the same with your last post.
0
 

Author Comment

by:jonnyboy69
ID: 12069609
I know but i found the solution before you posted.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question