memcached-1.1.13-pre+tags hack (quick and really dirty)

Björn Kalkbrenner terminar at cyberphoria.org
Wed Jul 19 01:40:53 UTC 2006


Hi,

i'm not sure if the first mail was sent to the mailinglist because i was
not subscribed yet, now i'll send it as subscribed user again.


i read about the memcached stuff some weeks ago, needed a replacement
for mysql for temp data. Memcached is perfect for that, but i even
needed stuff like a list of keys (something like a select). I read some
messages on this list (and saw it in the sourcecode) about the "problem"
of the hashlist and implementing something like that.

I found a solution that works for me, but this is far away from perfect.
This may even not be the way you would implement it. It's just a proof
of concept, this may only work on linux, i don't know.

Sorry Brad that i hacked the source so bad but it was the fastest way to
 provide this functionality.

First, because i am bad at the autoconf, i made a small Makefile
compiling the whole stuff with g++ (i needed std::map, std::string and
std::vector).

Second, i changed the source to work with g++, i hope no bugs jumped in
there.

Third i added a global std::map for the tags. Then i added some stuff to
the set command to provide the possibility to use tags. This should be
fully compatible for other memcached clients because the tags parameter
isn't a must. You CAN provide it.

Example:
--------
set test 0 0 1 foo\r\n
x\t\n

tags\r\n

list foo\r\n

-------

I hacked the provided php in the subversion repository to support the
list and tags. Maybe i hack the pecl memcached later, but at the moment
the php is enough for me.

Ok, now we can talk if some ideas of this will find it's way to the main
memcached distribution or are just ignored. If this will go to the
distribution, someone with more memcached knowledge should replace my
stl use which brakes much of the compatibility.

If nobody is interested, ignore this post. My modification is available at

http://www.cyberphoria.org/projects/memcached/


Bye
Björn Kalkbrenner



More information about the memcached mailing list