protected function lock($key)
{
$path = $key . '.lock';
for ($i = 0; $i < 25; ++$i) {
try {
$this->filesystem->write($path, '');
return true;
} catch (FileExistsException $e) {
usleep(200);
}
}
return false;
}