标签:blog http io ar os sp on 文件 art
1.安装么么cached服务,链接为http://i.cnblogs.com/Files.aspx,下载解压后放在一个文件夹下,在cmd中进入memcached路径下, 输入memcached.exe -d start ,
2.安装扩展,
3.重启服务
4.测试:
$memcache = memcache_connect(‘localhost‘, 11211);
if ($memcache) {
$memcache->set("str_key", "String to store in memcached");
$memcache->set("num_key", 123);
$object = new StdClass;
$object->attribute = ‘test‘;
$memcache->set("obj_key", $object);
$array = Array(‘assoc‘=>123, 345, 567);
$memcache->set("arr_key", $array);
var_dump($memcache->get(‘str_key‘));
var_dump($memcache->get(‘num_key‘));
var_dump($memcache->get(‘obj_key‘));
}
else {
echo "Connection to memcached failed";
}
标签:blog http io ar os sp on 文件 art
原文地址:http://www.cnblogs.com/xiaoyueer/p/4158540.html