已转开发,博客新地址:http://welcomezhang.iteye.com/

memcache engine入门

上一篇 / 下一篇  2011-11-23 19:48:14 / 个人分类:memcache(d)

MySQL Memcache_engine的安装与使用,链接http://blog.s135.com/post/357/
http://www.360doc.com/content/09/1026/17/41237_7894713.shtml
51Testing软件测试网n*S.u,ZOh_L0w,h
-------------------------
The memcache_engine allows memcache to work as a storage engine to MySQL. This means that you can SELECT/UPDATE/INSERTE/DELETE from it as though it is a table in MySQL.”。
memcache_engine可以让Memcache作为MySQL数据库的一个存储引擎和MySQL集成起来,然后直接使用标准的SQL进行SELECT/UPDATE/INSERTE/DELETE操作。虽然PHP可以很容易的操作Memcache,但是仍然没有memcache_engine来的方便和强大(还支持新浪的Memcachedbdbcached)。
示例如下:
CREATE TABLE `a` (
`a` int(11) NOT NULL DEFAULT '0',
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=MEMCACHE DEFAULT CHARSET=latin1
CONNECTION='localhost:6666\;localhost:6688';
-----------
#memcached -d -p 11211 -u nobody -m 256 -c 1024 -P /tmp/memcached.pid
#mysql
mysql> use memcache;
Database changed
mysql>
mysql> create table `memdata` (
   ->   `id` int(11) not null default '0',
   ->   `name` char(50) default null,
   ->   `info` varchar(255) default null,
   ->   primary key (`id`)
   -> ) engine=memcache default charset=latin1
   -> connection='localhost:11211';
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> insert into memdata (id, name, info) values (1, 'kevin', 'system');
Query OK, 1 row affected (0.01 sec)
mysql>
mysql> select * from memdata;
Empty set (0.00 sec)
mysql>
mysql> select * from memdata where id=1;
+----+-------+-----------+
| id | name  | info      |
+----+-------+-----------+
|  1 | kevin | system |
+----+-------+-----------+
1 row in set (0.00 sec)
mysql>quit;
memcache_engine到数据库,只能通过主键相等,否则查不出数据

TAG: engine memcache MemCache

 

评分:0

我来说两句

Open Toolbar