memcache storage engine for MySQL

Brian Aker brian at
Mon Aug 28 08:21:19 UTC 2006


I completed the "pre-alpha" of having memache act as a storage engine  
for MySQL

What works:
INSERT into foo SELECT ...

What doesn't work?
Probably ORDER BY operations.
REPLACE (I think)
IN ()
multiple memcache servers (this would be cake though to add)
table namespace, right now it treats the entire server as one big  

There is probably a lot more I haven't thought up that is now  
working. Right now the version I put up only allows you to have a  
primary key and one attribute. Doing multiple attributes means coming  
up with a way to store MySQL row format, aka UNIREG, in something  
which would be easy for anyone to take apart. Mark suggested XML, but  
XML would be damn slow to parse.

If you really want to use this, skip using the loadable interface and  
compile it directly in. I put some instructions in the README on how  
to do this. You will want to use the latest 5.1 tree.


mysql>  INSTALL PLUGIN memcache SONAME '' ;  
create table foo1 (k varchar(128) NOT NULL, val blob, primary key(k))  
ENGINE=memcache CONNECTION='localhost:6666';

mysql> insert into foo1 VALUES ("mine", "This is your head");
Query OK, 1 row affected (0.01 sec)

mysql> select * from foo1 WHERE k="mine";
| k    | val             |
| mine | This is my  dog |
1 row in set (0.01 sec)

mysql> delete  from foo1 WHERE k="mine";
Query OK, 1 row affected (0.00 sec)

mysql> select * from foo1 WHERE k="mine";
Empty set (0.01 sec)

Normal memcache clients can read the data and the engine will work  
with triggers.



Brian "Krow" Aker, brian at
Seattle, Washington
You can't grep a dead tree.

More information about the memcached mailing list