DHIS 2 user Ehcache as application cache provider by default. DHIS 2 can be configured to use other cache providers as well, such as memcached.
Memcached is a high-performance, distributed memory object caching system. A memcached server needs to be made available to DHIS 2, as it runs as a separate service outside DHIS 2.
To use memcached as DHIS 2 application provider you can set the following properties in the dhis.conf configuration file:
# Cache provider, can be 'ehcache', 'memcached' cache.provider = memcached # Cache servers, default is 'localhost:11211' cache.servers = localhost:11211 # Cache time in seconds, default is 600 cache.time = 600
Only the cache.provider setting is mandatory. You need to restart DHIS 2 for the change to take effect.
You can install memcached on Ubuntu using the following command:
sudo apt-get install memcached
Memcached will start by default after being installed and is available on localhost port 11211. You can start, stop and view the status of the memcached service using the following command:
sudo service memcached start | stop | status