The object will add a file lock before writing and release it right after the contents have been written. This can be used to prevent corruption of data when multiple requests try to write to the same file at the same time.
Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function load($path)
 {
     $yaml = $this->filesys->read($path);
     try {
         return $this->parser->parse($yaml);
     } catch (ParseException $e) {
         throw new LoadException($e->getMessage(), $e->getCode(), $e);
     }
 }
Esempio n. 2
0
 protected function generateDispatchData()
 {
     $data = $this->routeCollector->getData();
     if ($this->cachePath !== null) {
         $filesys = new LockingFilesystem();
         $php = '<?php return ' . var_export($data, true) . ";\n";
         $filesys->write($this->cachePath, $php);
     }
     return $data;
 }