Joe Stump

New PECL extension libmemcached released

Hey all –

It’s no secret that Digg uses Memcached. Along with our friends at Flickr, Facebook, StumbleUpon, Yahoo!, etc. we use it to alleviate stress on our databases. For those of you who aren’t sure what Memcached is, it’s essentially a way to make RAM available over a network for caching purposes.

PHP has, however, lagged behind some of the exciting new developments in the Memcached world. CAS, asynchronous features, consistent hashing, multi-get, etc. were either missing or buggy in the PECL extension. When I asked around I found out that Facebook and Yahoo! were maintaining their own Memcached clients, for the reasons I listed above, and didn’t have plans to release them anytime soon. Well, crap. What’s a PHP coder to do?!

Luckily, Digg recently hired PHP hacker extraordinaire, Andrei Zmievski, specifically for stuff like this. So we sat down with Andrei, laid out our current problems, white boarded what we’d like the API to look like and estimated out a sprint.

Andrei has been hacking away on this for about two months over at Github, and today we’re happy to announce that version 0.1.0 of the new memcached PECL extension has been released publicly. Here’s a short list of the goodies this new extension supports:

  • Built entirely on top of libmemcached, which has emerged as the standard library in the community (Python and Ruby’s clients use it as well).
  • Support for Memcached’s CAS functionality
  • Support for asynchronous mulit-get
  • Read-through cache and value callbacks
  • Support for Memcached’s binary protocol
  • Buffered writes

We haven’t started using this in production yet, but plan on integrating it quickly so I’m sure more work will be going into it over the coming months. If you end up using it on your own projects we’d love to hear about how it works out for you and, of course, any bugs you find.

Yay!

-Joe