protected function acquire($keys)
{
$keys = (array) $keys;
$values = array();
foreach ($keys as $key) {
$values["scrapbook.lock.{$key}"] = null;
}
// there's no point in locking longer than max allowed execution time
// for this script
$ttl = ini_get('max_execution_time');
// lock these keys, then compile a list of successfully locked keys
// (using the returned failure array)
$result = (array) $this->apcu_add($values, null, $ttl);
$failed = array();
foreach ($result as $key => $err) {
$failed[] = substr($key, strlen('scrapbook.lock.'));
}
return array_diff($keys, $failed);
}