Solved

Delete ALL cache items

Posted on 2004-09-15
7
321 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
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:zulu_11
Comment Utility
simply disable the Cache..use

Response.Cache.SetCacheability(HttpCacheability.NoCache)

Zulu
0
 
LVL 20

Accepted Solution

by:
ihenry earned 125 total points
Comment Utility
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
Comment Utility
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:jonnyboy69
Comment Utility
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
Comment Utility
so what's wrong with my suggestion...
0
 
LVL 20

Expert Comment

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

Author Comment

by:jonnyboy69
Comment Utility
I know but i found the solution before you posted.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now