Caching in Mura

Mura has a built in caching mechanism that (when enabled) will store content information in memory for reuse throughout a given site. The purpose for this is to improve overall site performance by decreasing the amount of reads to the database.

It's important to note that caching is done in a "lazy load" fashion. This means that the item will not be cached until it is called upon for the first time. It is also important to note that caching uses "soft references". This allows for improved memory management for the JVM. To ensure that there are no issues with soft references, whenever a page is updated the cache gets flushed entirely starting the caching process over again.

Now, there are a few ways to use caching within Mura:

  1. The first way is to use the built in cf_cacheomatic tag. For those who are not familiar with the tag, it give the user the ability to cache any desired display content.
  2. The second way is more or less baked into Mura itself but is worth mentioning here. Whenever a page is requested a content bean is created. If caching is turned on then the contents of the content bean are automatically cached for reuse.

Flow Diagram

How to use it

Within Mura's admin console you can go to any given site's "Basic" tab and turn the "Site Caching" option to "on".

Definition

The cf_cacheomatic tag:

<cf_CacheOMatic key="{a unique key}" nocache="{1=don't cache, 0=cache}">
    Content here ....
</cf_CacheOMatic>

Example Usage

The cf_cacheomatic tag:

<cf_CacheOMatic key="page#event.getContentBean().getContentID()#" nocache="#request.nocache#">
    <p>
        <cfoutput>
        The title of this page is #event.getContentBean().getMenuTitle()#.
        </cfoutput>
    </p>
</cf_CacheOMatic>