Memcached Cache Layer
|Updated||March 12, 2014|
|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 github.com:
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:
Memcached needs to be configured externally to dotcms and there is a lot to learn in running a memcached server. For more information, see: http://memcached.org
You point to a memcached server/port by using the dotmarketing-config.properties
Hopefully, the config is self documenting.
To test, fire up a memcached server locally, on port 11211 (should be the default):
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
The library used in this implementation is called XMemcached. You can read more about it here:
The code for adding or removing servers from the memcached cluster looks like this:
MemcachedCacheAdministratorImpl mem = (MemcachedCacheAdministratorImpl) CacheLocator.getCacheAdministrator().getImplementationObject(); mem.addServer("127.0.0.1:11212", 5); mem.removeServer("127.0.0.1:11212");