public function lock($key)
{
$key = $key . "::LOCK";
$start = microtime(true);
while ($this->cache->contains($key)) {
$passed = (microtime(true) - $start) * 1000;
if ($passed > $this->lockWaitTimeout) {
throw new LockWaitTimeoutException();
}
usleep($this->sleep);
}
$this->cache->save($key, true);
return;
}