public function acquireLock($key, $cache_level) { $name = $key . $cache_level; if ($this->r->hsetnx($this->_mapTags('_locks'), $name, time() + Registry::LOCK_EXPIRY)) { return true; } if ($ttl = $this->r->hget($this->_mapTags('_locks'), $name)) { if ($ttl < time()) { // lock expired $this->r->hset($this->_mapTags('_locks'), $name, time() + Registry::LOCK_EXPIRY); return true; } } return false; }