Solved

Delete ALL cache items

Posted on 2004-09-15
7
324 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
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
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.…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

16 Experts available now in Live!

Get 1:1 Help Now