1
0
mirror of https://github.com/danog/file.git synced 2024-11-30 04:19:39 +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} * {@inheritdoc}
*/ */
public function stat($path) { 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); StatCache::set($path, $stat);
\clearstatcache(true, $path); \clearstatcache(true, $path);
} else { } else {

View File

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