MODX - First step to solving issues or errors, clear your cache!

MODX is a powerful tool, but that doesn't mean sometimes it behaves a little off and knowing what to do when these strange things occur can help improve your day and of course, your workflow.  For this article, I'm going to focus on MODX Revolution and the funky things that could stop you up that have relatively easy fixes. 

Many of the weird things that you see in MODX are simply the result of an incorrect cache.  It should be the first step when debugging ANY MODX error or issue as it is often the solution to quirky site issues that suddenly occur.  Don't waste time debugging something without FIRST clearing the cache, not only in the MODX manager but by manually deleting the core/cache files themselves.  If the cache clear doesn't work, then move onto other options but remembering to do this can save a lot of unwarranted debugging time fairly often.

I worked with a site recently that was suspended from the host.  A simple oversight of course, the hosting was paid and the site put back online right away.  However after being reinstated, they had lost their menu entirely. 

One of the easiest and quickest ways to solve a little problem like this, that actually is a HUGE problem for the client, is to clear the cache.  Now this can be done a couple of ways.  One is to use the manager's "clear cache" fuction, found in the menu under site, or in MODX 2.3, under the Content.  For this site, that was all that was needed to renew the cache and the menu was again functional. 

However sometimes this is not enough to solve some issues.  In that case, you will want to clear the cache manually by deleting all the files in the core/cache folder.  In most cases, you do not want to do this from the files tab in the manager, but rather log into your site's hosting account and use it's file manager to navigate to and delete the files.  You can actually delete the cache folder itself and it will regenerate as soon as your site's home page is loaded in a browser window.

*Beware of your paths when deleting your core/cache files.   Always confirm that you are in the core/cache folder and NOT in the core folder. 

Sometimes you will want your clients to be able to do this on their own, or you would like to clear the core/cache folder without logging into your hosting account.  There is a great little tool from Bob Ray that will allow you to simply view a resource and clear the cache.  Try it: http://bobsguides.com/cache-clear-tutorial.html

  • Download and install the CacheClear package from Package Management
  • A resource will show up in your tree at the root level.  Make sure this resource doesn't show up in your site's menu by ticking the "hide from menus" option on the resource.  
  • Viewing this resource in your browser will clear the site's core/cache files for you.  

You can also log into your site via ftp and clear the core/cache files from your ftp client, but that is usually a very slow process and all the alternate methods described above will do the job nearly instantly in comparison. 


Comments (0)


Add a Comment





Allowed tags: <b><i><br>Add a new comment: