Skip to content

Latest commit

 

History

History
58 lines (45 loc) · 1.47 KB

cache.md

File metadata and controls

58 lines (45 loc) · 1.47 KB

Cache

As of RDMO 1.6, caching is not used anymore and memcached does not need to be installed anymore. However, if needed, we will enable this feature again in the future.

RDMO uses a cache for some of it's pages. In the development setup, this is done using local-memory caching. In production, we suggest using memcached Memcached can be installed on Debian/Ubuntu using:

sudo apt install memcached

On RHEL/CentOS a few more steps are needed. First install the package using:

sudo yum install memcached

Then edit the settings file to prevent external connections:

# in /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1"

Then start the service:

systemctl start memcached
systemctl enable memcached

Back in your virtual environment, according to docs.djangoproject.com/en/4.2/topics/cache, you need to install pymemcache:

pip install pymemcache

and add the following to your config/settings/local.py:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
        'KEY_PREFIX': 'rdmo_default'
    },
    'api': {
        'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
        'KEY_PREFIX': 'rdmo_api'
    }
}