1
0
Fork 0

Add cache to the lock file reading

pull/528/head
Jordi Boggiano 2012-04-02 21:46:28 +02:00
parent b2609e8413
commit 366176fc73
1 changed files with 9 additions and 1 deletions

View File

@ -26,6 +26,7 @@ class Locker
private $lockFile;
private $repositoryManager;
private $hash;
private $lockDataCache;
/**
* Initializes packages locker.
@ -108,7 +109,11 @@ class Locker
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);
// invalidate cache
$this->lockDataCache = null;
}
}