Ejemplo n.º 1
0
 /**
  * {@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);
 }
Ejemplo n.º 2
0
 /**
  * {@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();
 }
Ejemplo n.º 3
0
 private function onStat($data, $result, $req)
 {
     list($promisor, $path) = $data;
     \call_user_func($this->incrementor, -1);
     if ($result === -1) {
         $promisor->succeed(null);
     } else {
         StatCache::set($path, $result);
         $promisor->succeed($result);
     }
 }