Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.

Magnolia uses Ehcache for its back-end cache functionality. Ehcache is a robust, proven and full-featured cache product which has made it the most widely-used Java cache.

We recommend you use Ehcache 3 module instead.

Compared with Ehcache 2, the 3.x line brings important changes and improvements such as full compatibility with javax.cache API (JSR-107), off-heap storage capabilities, a revamped API, persistence, improved performance over Ehcache 2.x and much more.


Maven is the easiest way to install the module. Add the following to your bundle. The parent POM of your webapp project should set the latest version of the module automatically. Should you need to use a specific module version, you can define it using the <version/> in the dependency.



Ehcache has its own configuration options that can be set in /modules/cache/config/cacheFactory/defaultCacheConfiguration.

You can use a different cache library as long as you implement Java interfaces that allow you to configure caching behavior in the Configuration app. The library can be changed by implementing 

$webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources") Cache
$webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources") CacheFactory
. A cache factory is an interface that wraps the functionality and hides the configuration mechanism of the library you choose.

ParameterDefault valueDescription
Instructs Ehcache to wait the specified time in milliseconds before attempting to cache the request. Create the blockingTiemout property in the tree at the same level where the
$webResourceManager.requireResource("info.magnolia.sys.confluence.artifact-info-plugin:javadoc-resource-macro-resources") EhCacheFactory
class is defined, not inside the defaultCacheConfiguration node.
diskExpiryThreadIntervalSeconds120Number of seconds between runs of the disk expiry thread.
diskSpoolBufferSizeMB30Size to allocate to DiskStore for a spool buffer. Writes are made to this area and then asynchronously written to disk. Default: 30MB. Each spool buffer is used only by its cache. If OutOfMemory errors, you may need to lower this value. To improve DiskStore performance consider increasing it. Trace level logging in the DiskStore will show if put back ups are occurring.
eternaltrueIf elements are set to eternal, timeouts are ignored and the element is never expired.
maxElementsInMemory10000Sets maximum number of objects that will be created in memory. 0 = no limit
maxElementsOnDisk10000000Sets maximum number of objects maintained in the DiskStore. The default value of zero means unlimited.

Policy is enforced upon reaching the maxElementsInMemory limit. Available policies:

  • Least Recently Used (specified as LRU)
  • First In First Out (specified as FIFO)
  • Less Frequently Used (specified as LFU)
overflowToDisktruePermits elements to overflow to disk when the memory store has reached the maxInMemory limit.
timeToIdleSeconds0Optional attribute. Sets max idle time between accesses for an element before it expires. Only used if the element is not eternal. A value of 0 means that an Element can idle indefinitely.
timeToLiveSeconds0Sets lifespan for an element. Only used if the element is not eternal. Optional attribute. A value of 0 means an Element can live for infinity

When using the same webapp with ehcache for both author and public instance

If you are using the same webapp with ehcache for both author and public instance, you must set the property in the file. Make sure to assign different values for the different contexts!


If you do not set the property - the second starting instance will throw an exception: 
net.sf.ehcache.CacheException: net.sf.ehcache:type=CacheManager,name=/path-to-webapp#info.magnolia.module.cache.ehcache.EhCacheFactory#cacheManager