Example #1
0
 /**
  * {@inheritdoc}
  */
 public function put($path, $data)
 {
     $path = $this->getAbsolutePath($path);
     $this->filesystem->tryCreateDirectory(dirname($path), 0777, true);
     try {
         $this->filesystem->write($path, $data);
     } catch (FileSystemException $e) {
         throw Exception\StorageException::putError($path, $e);
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function write($id, $key, $value, $lockContext)
 {
     if ($lockContext) {
         /** @var File $file */
         $file = $lockContext;
     } else {
         $this->fs->tryCreateDirectory($this->getPath($id));
         $file = $this->openFile($id, $key);
         $file->lock();
     }
     $file->truncate(0);
     $file->seek(0);
     $file->write($value);
     $file->unlock();
 }