快捷搜索:  as  2018  FtCWSyGV  С˵  test  xxx  Ψһ  w3viyKQx

和记娱乐下载官方平台_机器人论坛



mysql 5.1支持触发器以及自定义函数接口(UDF)的特点,假如和记娱乐下载官方平台共同libmemcache以及Memcached Functions for MySQL,就能够实现memcache的自动更新。简单记录一下安装测试步骤。和记娱乐下载官方平台

安装步骤

安装memcached,这个步骤很简单,随处可见

安装mysql server 5.1RC,安装法子也很大年夜众,不废话了

编译libmemcached,解压后安装即可./configure; make; make install

编译Memcached Functions for MySQL,在找一个最新的版本下载便是,./configure --with-mysql=/usr/local/mysql/bin/mysql_config --libdir=/usr/local/mysql/lib/mysql/

make

make install

接下来有两个法子让Memcached Functions for MySQL在mysql中和记娱乐下载官方平台生效

在mysql的shell中履行memcached_functions_mysql源码目录下的sql/install_functions.sql,这会把memcache function作为UDF加入mysql

运行memcached_functions_mysql源码目录下的utils/install.pl,这是一个perl脚本,感化同上一条

测试memcache function

以下测试脚本摘自memcached_functions_mysql的源码目录,有兴趣可以试试

PLAIN TEXTCODE: drop table if exists urls;

create table urls (

id int(3) not null,

url varchar(64) not null default '',

primary key (id)

);

select memc_servers_set('localhost:11211');

select memc_set('urls:sequence', 0);

DELIMITER |

DROP TRIGGER IF EXISTS url_mem_insert;

CREATE TRIGGER url_mem_insert

BEFORE INSERT ON urls

FOR EACH ROW BEGIN

SET NEW.id= memc_和记娱乐下载官方平台increment('urls:sequence');

SET @mm= memc_set(concat('urls:',NEW.id), NEW.url);

END |

DELIMITER ;

insert into urls (url) values ('http://google.com');

insert into urls (url) values ('http://www.ooso.net/index.php');

insert into urls (url) values ('http://www.devdao.net/');

insert into urls (url) values ('http://slashdot.org');

insert into urls (url) values ('http://mysql.com');

select * from urls;

select memc_get('urls:1');

select memc_get('urls:2');

select memc_get('urls:3');

select memc_和记娱乐下载官方平台get('urls:4');

select memc_get('urls:5');

您可能还会对下面的文章感兴趣: