Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented CanOverwriteFiles to spare unnecessary calls to GCS #73

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mhlavac
Copy link

@mhlavac mhlavac commented Jan 12, 2018

Implemented CanOverwriteFiles to spare unnecessary calls to GCS

Filesystem will skip has check if adapter implements CanOverwriteFiles, when dealing with a lot of files this can lead to 50% less requests and up to 50% speed increase.

From Filesystem:

    /**
     * @inheritdoc
     */
    public function put($path, $contents, array $config = [])
    {
        $path = Util::normalizePath($path);
        $config = $this->prepareConfig($config);

        if ( ! $this->adapter instanceof CanOverwriteFiles && $this->has($path)) {
            return (bool) $this->getAdapter()->update($path, $contents, $config);
        }

        return (bool) $this->getAdapter()->write($path, $contents, $config);
    }

Filesystem will skip has check if adapter implements
CanOverwriteFiles, when dealing with a lot of files this can
lead to 50% less requests and up to 50% speed increase.
@RoofTurkey
Copy link

Looks good to me! Would be nice to have this implemented

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.

None yet

2 participants