Speed Matters: Maximizing Your Mura Cache - Mura Digital Experience Platform
In Flow: The Mura Blog

Speed Matters: Maximizing Your Mura Cache

August 14, 2018 by Grant Shepert

Caching is all about maximizing performance. Of your server, your website, of the user experience, not to mention SEO.

Speed matters. Fortunately, you have several good options to make sure your Mura site is screaming fast.

Dealing with Data

Most data only needs to be loaded once, ever. Some needs to be refreshed, always.

The rest sits in between, and this can be the trickiest bit.

When to refresh and how often, triggering updates and automatic flushes, the size, capacity and methods of storage—these are some of the deep riddles of an effective caching strategy.

Below are a few ways to ensure your dynamic data stays dynamic, and your static data gets managed in the most efficient way possible.

The standard cache

The default Mura cache is a straightforward but sometimes elusive beast. To enable it, simply go into the Site Settings > Edit Settings section of your Mura administrator and set Site Caching to On.

Understanding the kind of cache this is actually using behind the scenes can be important. The standard cache uses the Java Virtual Machine's (JVM) memory with java soft references. This means that the amount of available memory you assign to the JVM is very important.

Further enhance your caching strategy by using the custom "CacheOMatic" tag in your CFML code

You can set the percentage Mura will use of what's available (the setting for this is right below where you turned Site Caching on, in the Site Settings), and once that's full, the oldest records will be tossed out to make room for the new ones. If you are caching far more than you have allocated memory for, your cache's effectiveness can be quickly reduced, as the lifespan of a cached item will be very short. This is a function of the JVM garbage collector, so you literally have no control over it, other than allocating more memory for the JVM overall.

Elbow room

Another crucial factor is server load. When your server comes under heavy load, the JVM will throw out all java soft references (as it is supposed to). This prevents your site from filling the JVM with cache keys and crushing the memory needed to keep the server functioning under load.

The real cache

For an average website running under normal load, the default cache is more than adequate. In cases where you are exceeding the JVM memory or need guaranteed availability, you can easily set up a "real" cache.

You can do this by editing your site's config/settings.ini.cfm file, setting advancedCaching=true (you will have to reload the Mura application to enable this change).

Caching reduces the load on your server, increasing the speed at which your pages will load and the traffic capacity of your website.

If you are using Adobe ColdFusion, two caches will be created automatically for you (named {siteid}-data and  {siteid}-output). If you are using Lucee as your CFML engine, you have to create these yourself, before you update your advancedCaching setting to "true".

Customized content caching

If you are producing a lot of customized content (e.g. iterating over custom Mura ORM objects, or inside your own custom display objects) you can further enhance your caching strategy by using the custom "CacheOMatic" tag in your CFML code.

CacheOMatic is a custom tag wrapper that will put everything inside of it into the Mura cache. There are many examples here, including details on how to set your expiry counters and a nocache option to explicitly exclude cache.

You can also disable caching within a nested object (such as an included file) by setting a request variable:


This is necessary if your non-cacheable content doesn't have access to the CacheOMatic tag (i.e. inside a tag-wrapped include).

One other important feature is the purgecache option, which will clear the cached item. You can use variables (often an event variable) that defaults to false, and switches to true based upon your own custom criteria. This allows for a very customized, highly efficient caching strategy even for your own, custom content.

Advanced caching strategy

There are of course many advanced ways to deal with site caching, including tools like Varnish, high availability services like Cloud Flare, and even dedicated hardware caches.

Scientific American serves 3 million visitors per month, using Varnish with Mura to create a reverse proxy that allows them to scale and maintain a speedy experience. But in most cases, the way these tools are deployed is highly dependent upon the specific needs of the site or application.

When (and where) to start

When to start caching is actually an easy question to answer. Start as soon as your site is in production and receiving visitors. Caching reduces the load on your server, increasing the speed at which your pages will load and the traffic capacity of your website.

As to where to start, the Mura default cache is an adequate solution for the majority of websites. That said, there is no real downside to enabling a "real" Cache for your Mura site, if you have the server resources to enable it.

A key point to keep in mind is that enabling caching means some data that was once variable and updated on request is now stored and essentially 'static'. This can lead to unanticipated behavior where you've accidentally cached something that was meant to remain dynamic. As always it's advisable to thoroughly test your site to make sure you haven't trapped dynamic components inside your cache, and to use the CacheOMatic nocache=true tags to prevent it from being cached.

Speed Matters

Whether you're trying to maximize server resources, improve the user experience or boost SEO, caching is an effective tool that can help with all three. Secondary perhaps only to application security, implementation of a common-sense caching system is part of any complete deployment and maintenance strategy. Your server, your marketing team and most importantly, your site's visitors, will thank you for the friction-free experience and the Flow it helps create.

Additional resources

CacheOMatic documentation:

Mura settings.ini.cfm reference: