Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Clearing site cache programatically (C#)Clearing site cache programatically (C#)
Previous
 
Next
New Post
6/4/2012 7:22 PM
 

Hi,

I need to write a shim for a module while I wait for a response from the developer. There is a small issue with new users and how they interact with a specific module, I won't go into details, which goes away permanently once the site cache has been cleared once. So what I was hoping to do was clear the cache when a user hits the 'update' button they have to click anyways. 

My question is. How would I write this? Something that does exactly what the Host tool for clearing cache in DNN 6x does.

Cheers for the hlep

Mark

 
New Post
6/4/2012 7:40 PM
 
You can use Config.Touch() (from DotNetNuke.Common.Utilities.Config) to force a full app recycle - however it's better to use the DataCache class to remove the specific element(s) - it has a number of Clear* methods that allow granular expiry e.g. DataCache.ClearPortalCache(PortalId, true) , DataCache.ClearModuleCache(TabId) etc. You can also use it's Remove methods and pass in particular cache keys

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/4/2012 9:26 PM
 
Thanks

That was helpful. I could not use your suggested methods due to my references so I ended with this.

DataCache.RemoveCache(CStr(PortalId))

however it does not seem to do the same as a host tool cache clear would do.

any thoughts?
 
New Post
6/5/2012 12:43 AM
 
Config.Touch() worked! thanks
 
New Post
2/15/2014 4:15 PM
 

I know this is kinda old but I am on the same situation where I need to clear cache after updating something so I need to clear cache.  (like TOOLS / CLEAR CACHE) does but without restarting the application.  Is restarting the application like an app pool recycle or like a website restart?  If so, could that cause issues with modules that use sessions?  I tried the 2 above mentioned methods (clear and remove cache) but neither worked.  Anybody have any recommendations?

 

Thanks!

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Clearing site cache programatically (C#)Clearing site cache programatically (C#)


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out