Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delete ALL cache items

Posted on 2004-09-15
7
Medium Priority
?
349 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

636 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