New (experimental) C (and PHP) memcached library

Alex Stapleton alexs at advfn.com
Sat Apr 28 20:02:15 UTC 2007


Well I mentioned I had written a UDP capable C library for working  
with memcached a couple of days ago and here it is. It requires  
libketama, libevent and uses Boost.Build currently. Included is a PHP  
library that provides access to it, and pretty much zero  
documentation. There is a fairly comprehensive example program and a  
test PHP script as well. It works pretty well but has not been tested  
in any sort of failure scenario yet.

libevent: http://www.monkey.org/~provos/libevent/
libketama: http://www.last.fm/user/RJ/journal/2007/04/10/392555/

Here's the README with more info

=======

cmemcache - C memcached client
         authors: Alex Stapleton <alex.stapleton at gmail.com>
         version: 0.5 - Dedicated to Varablese, the Greek God of  
uncertainty.
         date: 28 Apr 2007

This is the first revision of this client, it seems to mostly work  
and valgrind
doesn't report any massive memory issues with it. *crosses fingers*  
This is
probably usable. It supports TCP and UDP and relies on libketama,  
libevent and
Bost.Build. Links to dependencies are down below. Currently it is  
assumed all
servers are operating in both UDP and TCP mode with the UDP port 1  
higher than
the TCP port listed in the ketama server file. This is a lame hack I  
know.
It should be pretty easy to add support to force a server to only do  
TCP though.

The PHP module has been tested under PHP4 and PHP5. This extension  
has not
been used in a high load situation yet. Proper QA and bugfixing has not
been done. This is going to be happening over the next week or two as we
roll it out onto our web servers.

Get requests are sent aynchronously using libevent which means you  
get pretty
good performance using large numbers of servers for batch requests.

I am almost certain there are horrendously evil bugs in this code. If  
anything
breaks and loses your customers or sets your parents on fire, it's  
not my fault.

=======

You can only get it from SVN right now the repo is at

svn checkout http://cmemcache.googlecode.com/svn/trunk/ cmemcache

Just type bjam to build it (assuming you have Boost.Build v2 installed.)

I'd appreciate any feedback (especially in the form of patches ;) no  
matter how scathing.

Alex Stapleton
alexs at advfn.com




More information about the memcached mailing list