Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

A pure python module to access memcached via its binary protocol with SASL auth support

Project description

A pure python module (thread safe) to access memcached via it’s binary with SASL auth support.

The main purpose of this module it to be able to communicate with memcached using binary protocol and support authentication, so it can work with Heroku for example.

Latest compiled docs on Read The Docs here.


Use pip or easy_install.

pip install python-binary-memcached


import bmemcached
client = bmemcached.Client(('', ), 'user',
client.set('key', 'value')

Using it with distributed keys

import bmemcached
client = bmemcached.DistributedClient(
    ('', ), 'user', 'password'
client.set('key', 'value')


python-binary-memcached unit tests are found in the test/ directory and are designed to be run using pytest. pytest will discover the tests automatically, so all you have to do is:

$ pytest
170 passed in 4.43 seconds

This runs the tests with the default Python interpreter.

You can also verify that the tests pass on other supported Python interpreters. For this we use tox, which will automatically create a virtualenv for each supported Python version and run the tests. For example:

$ tox
py27: commands succeeded
ERROR:  py34: InterpreterNotFound: python3.4
py35: commands succeeded
py36: commands succeeded
py37: commands succeeded
py38: commands succeeded

You may not have all the required Python versions installed, in which case you will see one or more InterpreterNotFound errors.

Using with Django

If you want to use it with Django, go to django-bmemcached to get a Django backend.

Tests Status



  • Implement Protocol.__str__ for real consistent hashing + test (#237)


  • Add ability to return default value on get but breaking get’s API
  • Support an arbitrary collection of keys, not just a list


  • added TLS support on #211 thanks to @moisesguimaraes!


  • moved bmemcached.Client to bmemcached.ReplicantClient but keeps backward compatibility
  • added DistributedClient to distribute keys over servers using consistent hashing

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for python-binary-memcached, version 0.30.1
Filename, size File type Python version Upload date Hashes
Filename, size python-binary-memcached-0.30.1.tar.gz (95.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page