금요일, 11월 15, 2024
HomeLinuxhow to memcache dump php

how to memcache dump php

how to memcache dump php

1. memcachedump.php

addServer('localhost', 11211, 1);
var_dump($m->getServerList());
$arCachedKeys = $m->getAllKeys();

//getAllKeys
var_dump("getAllKeys #1 :::::::::::::::");
foreach($arCachedKeys as $strKey)
{
        var_dump($strKey."|".$m->get($strKey));
}
var_dump("set key :::::::::::::::");
//set key value
foreach($arCachedKeys as $strKey)
{
	$m->set($strKey, time() , time()+600);
}
//getAllKeys
var_dump("getAllKeys #2 :::::::::::::::");
foreach($arCachedKeys as $strKey)
{
	var_dump($strKey."|".$m->get($strKey));
}
var_dump("");
var_dump($m->getResultCode().":".$m->getResultMessage());

?>

2.pakage

apt-get install php5-cli
apt-get install php-pear
apt-get install php5-dev
apt-get install libmemcached-dev
apt-get install php5-memcached

3. php memcache install

wget http://pecl.php.net/get/memcache-3.0.8.tgz
pear install memcache-3.0.8.tgz

4.php memcachedump.php > memcache.txt

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular