public function read($key, &$ttl_left = -1)
{
if (is_array($key)) {
$data = array();
$return_ttl = $ttl_left !== -1 ? true : false;
$ttl_left = array();
foreach ($key as $arr_key) {
$arr_key = (string) $arr_key;
$data[$arr_key] = apc_fetch($this->prefix . $arr_key, $success);
if (!$success) {
unset($data[$arr_key]);
continue;
}
if ($return_ttl) {
$ttl_left[$arr_key] = $this->getKeyTTL($arr_key);
}
}
} else {
$data = apc_fetch($this->prefix . $key, $success);
if (!$success) {
if (apc_exists($this->prefix . $key)) {
$this->ReportError('apc can not fetch key ' . $key, __LINE__);
}
return false;
}
if ($ttl_left !== -1) {
$ttl_left = $this->getKeyTTL($key);
if ($ttl_left < 0) {
$data = false;
}
//key expired
}
}
return $data;
}