Skip to content

Update filesystem adapter to Flysystem v2#251

Closed
gijsdev wants to merge 1 commit into
php-cache:masterfrom
gijsdev:flysystem2
Closed

Update filesystem adapter to Flysystem v2#251
gijsdev wants to merge 1 commit into
php-cache:masterfrom
gijsdev:flysystem2

Conversation

@gijsdev

@gijsdev gijsdev commented Oct 13, 2021

Copy link
Copy Markdown
Question Answer
Bug fix? no
New feature? no
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets php-cache/issues#147
License MIT
Doc PR

Description

This PR updates the Filesystem adapter to Flysystem v2

TODO

  • Add tests
  • Add documentation
  • Updated Changelog.md

@xvilo

xvilo commented Feb 16, 2022

Copy link
Copy Markdown

@gijsdev I just discovered it was not yet possible to use this with Flysystem 2.. Whats the current state of the PR? Do you need help?

@xvilo xvilo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently your PR was not fully according codestyle. I've created suggestions for you to easily apply it. Hopefully we could finish this somewhere this week or next week?

/**
* @param FilesystemInterface $filesystem
* @param FilesystemOperator $filesystem
* @param string $folder

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @param string $folder
* @param string $folder

$this->filesystem->createDir($this->folder);
try {
$this->filesystem->deleteDirectory($this->folder);
} catch(UnableToDeleteDirectory $e) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch(UnableToDeleteDirectory $e) {
} catch (UnableToDeleteDirectory $e) {


try {
$this->filesystem->createDirectory($this->folder);
} catch(UnableToCreateDirectory $e) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch(UnableToCreateDirectory $e) {
} catch (UnableToCreateDirectory $e) {

@@ -119,16 +131,11 @@ protected function storeItemInCache(PhpCacheItem $item, $ttl)
);

$file = $this->getFilePath($item->getKey());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$file = $this->getFilePath($item->getKey());
$file = $this->getFilePath($item->getKey());

// To handle issues when/if race conditions occurs, we try to update here.
return $this->filesystem->update($file, $data);
$this->filesystem->write($file, $data);
return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return true;
return true;


return $this->filesystem->update($this->getFilePath($name), serialize($list));
try {
$this->filesystem->write($this->getFilePath($name), serialize($list));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->filesystem->write($this->getFilePath($name), serialize($list));
$this->filesystem->write($this->getFilePath($name), serialize($list));

} catch (UnableToWriteFile $e) {
return false;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


return $this->filesystem->update($this->getFilePath($name), serialize($list));
try {
$this->filesystem->write($this->getFilePath($name), serialize($list));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->filesystem->write($this->getFilePath($name), serialize($list));
$this->filesystem->write($this->getFilePath($name), serialize($list));

try {
return $this->filesystem->delete($this->getFilePath($key));
} catch (FileNotFoundException $e) {
$this->filesystem->delete($this->getFilePath($key));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->filesystem->delete($this->getFilePath($key));
$this->filesystem->delete($this->getFilePath($key));

@gijsdev gijsdev closed this by deleting the head repository Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants