Memcached Cache Layer

Memcached Cache Layer

Updated March 12, 2014
Author Dotcms (Dotcms)
Version 1.0
Compatible [2.5]
Description This plugin overrides the internal dotcms caching infrastructure (Guava) and replaces it with memcached, an external caching server that can be indepently networked and scaled.

The plugin can be downloaded on

Dotcms & Memcached

This plugin will override the internal dotcms caching infrastructure (Guava) and replace it with memcached, an external caching mechanism.


The benefits of memcached are multiple:

  • the caching infrastructure becomes a networked server (or cluster) itself
  • the caching server can be scaled independently and at runtime in order to add/remove cache capacity.
  • Removes Dotcms cache from the java heap, which should lower Dotcms memory requirement and speed up GC significantly.
  • Cache "puts" and "removes" are network-wide - there is no external syncing mechanism that can fail.
  • Dotcms servers can be restarted with their caches fully loaded, which can be a boon for large implementations.
  • Amazon offers a cloud based memcached infrastructure called Amazon ElastiCache that can scale your cache in the cloud

About Memcached

Memcached needs to be configured externally to dotcms and there is a lot to learn in running a memcached server. For more information, see:


You point to a memcached server/port by using the

Hopefully, the config is self documenting.


To test, fire up a memcached server locally, on port 11211 (should be the default):

memcached -vv

Then deploy this plugin, start dotcms and volia, you should see cache messages scrolling on your memcached server. To run memcached as a Deamon, you need to pass it the -d option

memcached -d


The library used in this implementation is called XMemcached. You can read more about it here:

Adding and removing servers from the memcached cluster

The code for adding or removing servers from the memcached cluster looks like this:

MemcachedCacheAdministratorImpl mem = (MemcachedCacheAdministratorImpl) CacheLocator.getCacheAdministrator().getImplementationObject();
mem.addServer("", 5);
Plugins are feature additions outside of the dotCMS core code and unless explicitly stated otherwise, are not covered under the enterprise warranty. However, support for plugins is available through our professional services department. Contact us for more information.