django-bmemcached

raw JSON →
0.3.0 verified Fri May 01 auth: no python deprecated

A Django cache backend using the bmemcached module (binary protocol with SASL authentication). Current version 0.3.0. Low release cadence; last release in 2015.

pip install django-bmemcached
error InvalidCacheOptions: Option 'xxx' is not a valid memcached option
cause You passed an OPTIONS key not in the whitelist.
fix
Remove the key or add it to the whitelist in django_bmemcached/memcached.py.
error ImportError: No module named bmemcached
cause Missing bmemcached dependency (the underlying library).
fix
pip install bmemcached
error ImproperlyConfigured: Error importing cache backend module 'django_bmemcached.memcached': No module named django_bmemcached
cause django-bmemcached not installed or import path wrong.
fix
pip install django-bmemcached and use 'django_bmemcached.memcached.BMemcachedCache'.
breaking OPTIONS keys are validated against a whitelist. Unrecognized keys raise InvalidCacheOptions.
fix Only use keys: 'username', 'password', 'pickleProtocol', 'behaviors', and others listed in the source.
deprecated Library is unmaintained since 2015. Does not support modern Django versions (2.x, 3.x, 4.x).
fix Consider migrating to django-pylibmc or django-corecache.
gotcha The import path in Django CACHES settings must be 'django_bmemcached.memcached.BMemcachedCache', not 'django_bmemcached.BMemcachedCache'.
fix Use BACKEND: 'django_bmemcached.memcached.BMemcachedCache'.

Django settings configuration for using bmemcached with authentication.

import os

CACHES = {
    'default': {
        'BACKEND': 'django_bmemcached.memcached.BMemcachedCache',
        'LOCATION': [os.environ.get('MEMCACHED_HOST', '127.0.0.1:11211')],
        'OPTIONS': {
            'username': os.environ.get('MEMCACHED_USER', ''),
            'password': os.environ.get('MEMCACHED_PASS', ''),
        }
    }
}