<?php
$m=new test_memcache('127.0.0.1');
$m->m_set('k','kangchaojie');
echo $m->m_get('k');
class test_memcache{
public $m;
public $host;
public $port;
function __construct($host,$port=11211){
$m=new Memcache();
$m->connect($this->host=$host,$this->port=$port);
$this->m=$m;
}
//设置
function m_set($key,$value){
return $this->m->set($key,$value,0,60);
}
//获取
function m_get($key){
return $this->m->get($key);
}
//删除
function m_del($key){
return $this->m->delete($key);
}
}
?>