Monday, April 7, 2008

Python memcached

Installing the python bindings for the C libmemcached:
  1. Patch libmemcache

  2. It's been a while since I used patch, so I thought I'd record the command I used. This was a multifile patch, and it applies the patches to all the right files. How cool is that! The -p1 prunes off one slash of the path since my directory was different to the guys who made the patch.

    patch -b -p1 -i libmemcache-1.4.0.rc2.patch

  3. Compile and install libmemcache

  4. sudo apt-get install python-dev

  5. sudo python setup.py install

  6. Download the actual memcached, compile and install

  7. Use it (StringClient for strings, Client uses pickle for other types):


  8. import cmemcache
    a=cmemcache.StringClient(["127.0.0.1:11211"])
    a.set('key', 'value')
    a.get('key')

1 comment:

meppum said...

Which version of cmemcached did you install?