//create a memcache object
$mem = new Memcache();
//create connection
$mem->connect('localhost',11211);
//save a value
$mem->set('key1','This is first value',0,60);
//save a array
$arr = array(1,2,3,4,5);
$mem->set('key2',$arr,0,60);
print_r($mem);
//get a value
$val1 = $mem->get('key');
//replace the value
$mem->replace('key1'."This is second value",0,60);
//delete the value
$mem->delete('key2');
//flush all value
$mem->flush();
//close connection
$mem->close();