A Quick Guide to MODX Caching Packages

If Cache is King...

In the world of website performance, Cache is King. Well, actually optimizing your codebase should come first, but assuming you've done that, the preeminent methods for increasing site speed all involve caching at some level. In this post we're going to explore the robust Add-on Packages in the MODX Extras Repo that can help you implement a finely-tuned, custom caching strategy.

Core Caching

Before we dive into the Add-on Packages, let's quickly review what MODX's core caching mechanism does, and how it does it:

  • By default, writes cache files to the local filesystem under the /core/cache/ folder in various partitions
  • Caches the output of any cacheable Resource in the resource cache partition, on first request
  • Clears the cache when a Resource is saved, or created - unless the "Empty Cache" option is manually disabled


URL in Extras Repo: http://modx.com/extras/package/getcache
Documentation: https://github.com/opengeek/getCache/wiki

getCache allows you to store the output of specific Snippet calls and Chunk calls from your template into a custom folder location that you specify, which can optionally persist even after the Resource cache is cleared.

Use case example: you have global elements like navigation, footers, etc that don't need to be refreshed every time a new Resource is published. These elements may include slower queries, etc that can beneifit from being cached on a more persistent basis. getCache lets you do all that and more.


URL in Extras Repo: http://modx.com/extras/package/statcache
Documentation: https://github.com/opengeek/statcache/wiki

statcache renders fully cacheable resources into flat, static files. A server directive is required to try the statcache location on the filesystem first, and only if the static file does not exist will MODX then handle the request.

Use case example: you have certain pages that don't contain any dynamic content, such as an "about" page, but receive a lot of traffic. By circumventing php entirely for those requests, your server can deliver more responses with less processor load.


URL in Extras Repo: http://modx.com/extras/package/microcache
Documentation: https://github.com/opengeek/microcache/wiki

microcache sets public cache-control headers on cacheable Resources so that browsers and upstream proxies can cache responses, reducing load on your server.

Use case example: pretty much every MODX site can benefit from this. The plugin is smart enough to know when a Resource isn't cacheable, like a session-dependent one, so you just install the plugin and watch the magic happen.


URL in Extras Repo: http://modx.com/extras/package/cacheguard2

cacheguard registers an ExtJS script to uncheck the "Empty Cache" checkbox when a Manager user edits an unpublished Resource. On the save event, it clears the cache for that one Resource only so new changes can be viewed.

Use case example: if your site gets frequent content updates, then most likely your content editors frequently save their work-in-progress. By preventing the cache from being cleared on these frequent save events, the cache for Live Resources will survive longer and help reduce server load. Can be manually overridden on every save event.

Alternate Cache Providers

Out-of-the-box, MODX also supports these alternative cache providers:

Of course you need to ensure the required PHP extensions are installed on your server. In multi-node environments you can use the Remotes plugin to synchronize the disparate local caches. These two providers cache in memory rather than on the filesystem, so as long as you've provisioned sufficient RAM, you will gain noticeable speed improvements.

...MODX is the Hand of the King!

You can do pretty much anything in MODX. It affords you Total Creative Freedom. With these Add-on Packages, you also have Total Cache Control.

Hi. We’re MODX.

We’re here to help you fix, build and grow fantastic sites. How can we help?

How can we help?

Tell us the general reason for reaching out so we can connect you with the right team.

MODX Diagnostics

MODX’s Open Source software is 100% free for anyone to download and use. As the team behind it for more than a decade, we know it inside, out, and then some.

Like any software, sometimes things break; we can usually fix them very fast. But, we do have to charge for our time to support our families and fund its ongoing development. There are almost an unlimited variety of things that can cause problems, including server upgrades, corrupt files, accidental changes, outdated software, database hiccups and more. We will save you a lot of time and frustration, and get you back in action.

With our MODX Diagnostic service, we determine the source of issues, and often fix them on the spot. For more extensive problems needing more time, like hacked sites or overdue upgrades, we provide additional estimates and guidance. MODX Diagnostics cost $99 for standard business hours support (US Central Time), or $500 for priority, rush or after-hours emergencies.

If you don’t have budget for professional support from the source, you look for answers in the MODX Forums or Documentation, or seek help from MODXers in the Community Slack, or from MODX Professionals near you.

Get Support Now

After submitting this we will contact you to collect any access credentials in a secure support ticket. We look forward to helping restore your site back to full health.

Hi! We’d love to work together.

If you have a simple problem that needs our assistance, please request quick fix help here.

What should we keep in mind?

The project involves:
(select all that apply)
What are you planning?
(select all that apply)

Some other considerations

Specific project information

Commercial Support Customers

Customers with a current Commercial Support agreeement can get help using this form. Learn more about MODX Preferred Support.

Let’s get started

What seems to be the issue?

Contact MODX

We welcome conversations, ideas, inquiries and even the occassional cold sales call, but support and requests about how to use MODX software sent via this form cannot be guaranteed a response. That said, we try to respond to everyone that reaches out to us within two business days.

To report a security issue or file a bug for MODX software, please email security [at] modx.com to reach our security team. If you are looking for help with MODX, many times you can find an answer in the MODX Forums or MODX Documentation, from MODXers in realtime at the MODX Community Slack Channel, or from a MODX Professional near you.

How can we help?