(Quick Reference)

2 Getting Started - Reference Documentation

Authors: Burt Beckwith

Version: 1.0.3.2

2 Getting Started

The first step is to install the plugin:

grails install-plugin memcached

Then you just need to configure the memcached server(s). This is done with a space-delimited list of server names and ports. Combine each server name and port with a colon, e.g.

grails.plugin.memcached.hosts = 'localhost:11211'

or

grails.plugin.memcached.hosts = 'memcached1.yourcompany.com:11211 memcached2.yourcompany.com:11211 memcached5.yourcompany.com:11211'

or

grails.plugin.memcached.hosts = '10.10.0.1:11211 10.10.0.2:11211 10.10.0.5:11211'

Often memcached is behind a firewall and security isn't important but if your servers need a username and password you can configure those:

grails.plugin.memcached.username = 'the username'
grails.plugin.memcached.password = 'the password'

DataSource.groovy changes

You can change the hibernate.cache.provider_class property from its default value ('org.hibernate.cache.EhCacheProvider') in DataSource.groovy if you want, but its value will be ignored and reconfigured to be 'com.googlecode.hibernate.memcached.MemcachedCacheProvider'. One reason to edit the file is to make it more clear that you're using memcached, but it's not required.