Experimental patch - ring buffers

Nathan Schmidt nschmidt at gmail.com
Sun May 6 08:59:32 UTC 2007

We've been kicking around the idea of ring buffers in memcached for a
week or two. The premise is that something like an RSS feed is
composed of some ordered list of n most recent items. Assembling this
via incr / multi_get wasn't providing the kind of interface we wanted,
and it's pretty easy to come up with some really interesting use cases
for memcache-style 'results are correct if they're not undef' using a
few new base commands.

Create a new ring
 ring <key> 0 <exp> <capacity>\r\n

Push a value onto the ring
 push <key> 0 <ignored> <length>\r\n<value\r\n

Get the empty-string-delimited concatenated values available on the ring
 rget <key>\r\n

These patches are basically a rough draft which pass my .t tests on
daemon and client side -- would love to hear feedback about the
operators and use cases other folks on the list can come up with.

(This was written at a Cinco De Mayo party
http://superhappydevhouse.org/SuperHappyDevHouse17, which may explain
the rough edges.)

Have fun,
-Nathan / PBwiki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: memcached-1.2.1-rbuf.patch
Type: application/octet-stream
Size: 23202 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070506/84af8fa5/memcached-1.2.1-rbuf-0001.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Cache-Memcached-1.14-rbuf.patch
Type: application/octet-stream
Size: 3177 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/memcached/attachments/20070506/84af8fa5/Cache-Memcached-1.14-rbuf-0001.obj

More information about the memcached mailing list