memcache storage engine for MySQL

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


Hi!

I completed the "pre-alpha" of having memache act as a storage engine  
for MySQL
http://tangent.org/index.pl?lnode_id=506

What works:
SELECT, UPDATE, DELETE, INSERT
INSERT into foo SELECT ...

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

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.

Example:

mysql>  INSTALL PLUGIN memcache SONAME 'libmemcache_engine.so' ;  
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.

Cheers,

	-Brian

--
_______________________________________________________
Brian "Krow" Aker, brian at tangent.org
Seattle, Washington
http://krow.net/
http://tangent.org/
_______________________________________________________
You can't grep a dead tree.





More information about the memcached mailing list