Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (33 sloc) 1.46 KB


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


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 memcachepool.cache.UMemcacheCache as backend in your settings.

Also, make sure you use umemcache >= 1.5

Here's an example:

    'default': {
        'BACKEND': 'memcachepool.cache.UMemcacheCache',
        'LOCATION': '',
        'OPTIONS': {
                'MAX_POOL_SIZE': 100,
                'BLACKLIST_TIME': 20,
                'SOCKET_TIMEOUT': 5,
                'MAX_ITEM_SIZE': 1000*100,


  • MAX_POOL_SIZE: -- The maximum number of connectors in the pool. default: 35.
  • BLACKLIST_TIME -- The time in seconds a server stays in the blacklist. default: 60
  • SOCKET_TIMEOUT -- the time in seconds for the socket timeout. default: 4
  • MAX_ITEM_SIZE -- The maximum size for an item in Memcache.
Jump to Line
Something went wrong with that request. Please try again.