class mem
{
public $memcache=null;
public $array=array();
public function __construct()
{
$this->memcache = new Memcache;
$this->memcache->connect('localhost', 11211) or die ("Could not connect");
}
public function add($parent="",$key="",$value="")
{
$this->array[$key]=$value;
$this->memcache->set($parent,$this->array,false,500);
}
public function deleteGroup($key=null)
{
$this->memcache->delete($key);
}
public function get($key=null)
{
return $this->memcache->get($key);
}
}
$mem=new mem();
$mem->add("cacheGroup","cacheName1","1");
$mem->add("cacheGroup","cacheName2","2");
$mem->add("cacheGroup","cacheName3","3");
//$mem->deleteGroup("cacheGroup");
var_Dump($mem->get('cacheGroup'));