?
Solved

Delete ALL cache items

Posted on 2004-09-15
7
Medium Priority
?
339 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 375 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
Technology Partners: 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

Technology Partners: 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!

Question has a verified solution.

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

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…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

771 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