atxgeek 


just one more geek in a sea of austin techies

June 8, 2014

TIP: Clear DNN Cache #DotNetNukeGeek

Have you found yourself needing to programatically clear DotNetNuke (DNN) cache but were dismayed to discover newer DNN versions no longer rely on an easily-cleared cookie?

Here's a simple option to force the cache to clear...



Clearing Cache
So you have a need to clear a DNN user's cache but you're using a newer version of DNN that no longer stores things in an easily-cleared cookie.  If this describes you then you're probably:
  • Bypassing DNN's "correct" mechanisms (built-in objects and the Data Access Layer) by directly calling SQL stored procedures.
     
  • Querying straight through to data stored in SQL tables.

    (It's ok -- I won't judge.)

As an admin you have DNN's built-in options for clearing cache or even "resetting the application domain".  Your end users, however, lack these options and, really, why would you want users to have to do anything special? You want a solution that's hidden and automatic.

Cut to the chase:
Below is a link to a free DNN7 module that does one thing:  flush the cache.  Drop the module on a page, set the VIEW permissions for whatever group(s) you want the module to be active for and that's it.

Oh -- you'll also want to blank out the module's title field.  And THAT'S it.

Free DNN7 module:  ATXGeek Clear DNN Cache

There is no reason to allow "All Users" since no
user-specific data is cached when not logged in.
The module itself has no configuration options.  The only real point to consider is who you want the module to fire for.  Users who are not logged in have no user-specific data to flush so you can rule out "Unverified Users" and, by extension, "All Users" (which is the combination of "Registered Users" and "Unverified Users").  In most cases you'll probably want to set the VIEW permission to "Registered Users".

Note that you do *not* want to use this module on pages with lots of traffic.  Constantly flushing cache is an excellent way to cripple a busy site.  This module is best used on infrequently-visited pages (such as a custom "user update" page).

Additional Thoughts:  Short and Sweet
The module required less than 10 minutes to create using DNN's built in "module creator" feature (that means I created it from within a DNN website using nothing but the web browser) and less than 5 minutes to create the deployment package using DNN's built in "create package" feature but... those are topics for another day.

No comments:

Post a Comment