示例#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);
 }
示例#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();
 }
示例#3
0
文件: EioDriver.php 项目: amphp/file
 /**
  * {@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();
 }