1
0
mirror of https://github.com/danog/file.git synced 2024-11-29 20:09:10 +01:00

Fix stat cache derps

This commit is contained in:
Daniel Lowrey 2015-08-29 07:34:18 -04:00
parent 4bda31dd5f
commit 498022983e
2 changed files with 7 additions and 1 deletions

View File

@ -24,7 +24,9 @@ class BlockingDriver implements Driver {
* {@inheritdoc}
*/
public function stat($path) {
if ($stat = @\stat($path)) {
if ($stat = StatCache::get($path)) {
return new Success($stat);
} elseif ($stat = @\stat($path)) {
StatCache::set($path, $stat);
\clearstatcache(true, $path);
} else {

View File

@ -94,6 +94,10 @@ class UvDriver implements Driver {
* {@inheritdoc}
*/
public function stat($path) {
if ($stat = StatCache::get($path)) {
return new Success($stat);
}
$this->reactor->addRef();
$promisor = new Deferred;
\uv_fs_stat($this->loop, $path, function($fh, $stat) use ($promisor, $path) {