php代码
<?php function test($key='name'){
$md5 = substr(md5($key), 0, 8);
$seed = 31;
$hash = 0;
for($i=0; $i'192.168.1.2', 'port'=>6379),
array('host'=>'192.168.1.3', 'port'=>6379),
array('host'=>'192.168.1.4', 'port'=>6379),
array('host'=>'192.168.1.5', 'port'=>6379),
);
$key = 'username';
$value = 'lane';
//根据KEY获取hash
$hash = $this->test($key);
$count = count($mamcacheList);
$mamcache = $mamcacheList[$hash % $count];
$mc = new Mamcached($mamcache);
$mc->set($key, $value);
?>
php免费学习视频:立即使用
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!










