Skip to main content

An efficient fast Django Memcached backend with a pool of connectors, based on pymemcache.

See https://github.com/zhumengyuan/djmemcache

Each connection added in the pool stays connected to Memcache or Membase, drastically limiting the number of reconnections and open sockets your application will use on high load.

If you configure more than one Memcache server, each new connection will randomly pick one.

Everytime a socket timeout occurs on a server, it’s blacklisted so new connections avoid picking it for a while.

To use this backend, make sure the package is installed in your environment then use djmemcache.backend.PyMemcacheCache as backend in your settings.

Here’s an example:

CACHES = {
    'default': {
        'BACKEND': 'djmemcache.backend.PyMemcacheCache',
        'LOCATION': '127.0.0.1:11211',
        'OPTIONS': {
                'MAX_POOL_SIZE': 100,
                'KEY_PREFIX': b'uuboard_prefix',
                'TIMEOUT': 30,
                'CONNECT_TIMEOUT': 30,
                'IGNORE_EXC': True,
                'USE_POOLING': True
            }
        }
    }

Options:

  • MAX_POOL_SIZE: – The maximum number of connectors in the pool for eatch host. default: 2 ** 31.

  • KEY_PREFIX – The time in seconds a server stays in the blacklist. default: b’’

  • TIMEOUT – The time in seconds for the socket timeout. defaults to “forever”

  • CONNECT_TIMEOUT – The time in seconds for the connect socket timeout. defaults to “forever”

  • USE_POOLING – Whether to apply the connection pool. defaults to “True”

2015-04-30 - 0.1

  • Initial release

Metadata

Release files for djmemcache 0.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djmemcache 0.13
File Size Uploaded
djmemcache-0.13.tar.gz 3.2 kB Details

Release files / djmemcache-0.13.tar.gz

Download URL djmemcache-0.13.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
31045bf474bb496c8c605bc79d45f5c19ddf980f8cccba7ba2b74f3d6106c875
BLAKE2b-256 checksum
How to use checksums
a84db15631d4a9ea6d76bc5481ac5d0d6afc6c47ca7b4e619945c74da6c4e26b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

0.13 This release

1 release file

0.12

1 release file

0.11

2 release files

0.10

1 release file

0.9

1 release file

0.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page