/** * {@inheritdoc} */ public function stat($path) { if ($stat = StatCache::get($path)) { return new Success($stat); } elseif ($stat = @\stat($path)) { StatCache::set($path, $stat); \clearstatcache(true, $path); } else { $stat = null; } return new Success($stat); }
/** * {@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) { if (empty($fh)) { $stat = null; } else { StatCache::set($path, $stat); } $this->reactor->delRef(); $promisor->succeed($stat); }); return $promisor->promise(); }
/** * {@inheritdoc} */ public function stat($path) { if ($stat = StatCache::get($path)) { return new Success($stat); } \call_user_func($this->incrementor, 1); $promisor = new Deferred(); $priority = \EIO_PRI_DEFAULT; $data = [$promisor, $path]; \eio_stat($path, $priority, [$this, "onStat"], $data); return $promisor->promise(); }