/** * Locks a cache entry. * * @param string $key - Key of the cache entry to lock */ public function lock($key) { // For some weird reason, storing a simple timestamp does not work, so use prefix. $lock_expiration = max(array(ini_get('max_execution_time'), 30)); return $this->memcached->add($this->prefix . self::LOCK_PREFIX . $key, self::LOCK_PREFIX . $this->timeNow, $lock_expiration); }