Add cache to the lock file reading
parent
b2609e8413
commit
366176fc73
|
@ -26,6 +26,7 @@ class Locker
|
||||||
private $lockFile;
|
private $lockFile;
|
||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
private $hash;
|
private $hash;
|
||||||
|
private $lockDataCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes packages locker.
|
* Initializes packages locker.
|
||||||
|
@ -108,7 +109,11 @@ class Locker
|
||||||
throw new \LogicException('No lockfile found. Unable to read locked packages');
|
throw new \LogicException('No lockfile found. Unable to read locked packages');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->lockFile->read();
|
if (null !== $this->lockDataCache) {
|
||||||
|
return $this->lockDataCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->lockDataCache = $this->lockFile->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,5 +155,8 @@ class Locker
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->lockFile->write($lock);
|
$this->lockFile->write($lock);
|
||||||
|
|
||||||
|
// invalidate cache
|
||||||
|
$this->lockDataCache = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue