I just wanted to note that in the 1.45 release of the python-memcache module I have switched the hash algorithm to be compatible with the other libraries, thanks to code by Andre Cru and Ludvig Ericson. To switch back to the old-style hashing, call:

memcached.useOldServerHashFunction()

Read on for more information about the release.

I originally put this in place as something that was disabled by default and you had to explicitly enable. However, in looking at the original hashing code, and the code submitted by Andre, I came to the opinion that the previous hashing function was buggy rather than intentionally different for some reason. And I couldn't come up with a good way to gracefully migrate to the new hashing.

A painful decision, but hopefully the last time that impacts the python-memcache code.

The other big, notable change is patches from John McFarlane and Aryeh Katz which make the objects easier to garbage collect. Previously there was a circular object reference which caused the objects to never get GCed. I'm not sure why I hadn't noticed that before, because almost all the pages on our website go through python-memcached. But we just recently migrated to a newer OS install and all of a sudden started getting hit by that problem, a few days after I got one of the reports of the problem.

Here's the full change-log:

Per-connection max server key length. Patch by Nicolas Delaby

Patches to make memcached more garbage-collectable. Removes “debugfunc” argument from _Host objects and changed to “debug” boolean. Patches by John McFarlane and Aryeh Katz.

Switching to a cmemcache compatible hash function. Implemented by Andre Cru and Ludvig Ericson. To switch back to the old style, use: memcached.useOldServerHashFunction()

Rejecting keys that have spaces in them. Patch by Etienne Posthumus.

Fixing exception raising syntax. Patch by Samuel Stauffer.

Optimizations in read code. Patch by Samuel Stauffer.

Changing classes to be newstyle. Patch by Samuel Stauffer.

Changed “has_key” to “in”. Patch by Samuel Stauffer.

incr/decr were raising ValueError if the key did not exist, the docstring said it returned none. Patch by Chihiro Sakatoku.

Adding cas method, submitted by Ben Gutierrez.

Fix in the docstring for how to use the “set” method. Found and fixed by William McVey