Board logo

标题: [求助] 一个Memcache测试脚本,但显示没安装Memcache [打印本页]

作者: 小哈    时间: 2014-2-21 17:14     标题: 一个Memcache测试脚本,但显示没安装Memcache

<?php
$loop = 10000;
echo 'loop : ';
echo $loop*5;
$mcd = new Memcached;
$mcd->addServer('127.0.0.1', 11211);
$mcd->set('test/key/1', 'test/key/1',360000);
$mcd->set('test/key/2', 'test/key/1',360000);
$mcd->set('test/key/3', 'test/key/1',360000);
$mcd->set('test/key/4', 'test/key/1',360000);
$mcd->set('test/key/5', 'test/key/1',360000);
echo '<br>';
echo 'Memcached : ';
$start = microtime(true);
for ($i = 0; $i < $loop; ++$i) {
    $mcd->get('test/key/1');
    $mcd->get('test/key/2');
    $mcd->get('test/key/3');
    $mcd->get('test/key/4');
    $mcd->get('test/key/5');
}
echo microtime(true) - $start, "s.<br>";

$mc = new Memcache;
$mc->pconnect('127.0.0.1', 11211);
echo 'Memcache : ';
$start = microtime(true);
for ($i = 0; $i < $loop; ++$i) {
    $mc->get('test/key/1');
    $mc->get('test/key/2');
    $mc->get('test/key/3');
    $mc->get('test/key/4');
    $mc->get('test/key/5');
}
echo microtime(true) - $start, "s.<br>";

?>

运行结果
oop : 50000
Fatal error: Class 'Memcached' not found in /www/web/public_html/mct.php on line 5




欢迎光临 WDlinux官方论坛 (http://wdlinux.cn/bbs/) Powered by Discuz! 7.2