Skip to content

Implemented CanOverwriteFiles to spare unnecessary calls to GCS#73

Open
mhlavac wants to merge 1 commit into
Superbalist:masterfrom
mhlavac:can-overwrite
Open

Implemented CanOverwriteFiles to spare unnecessary calls to GCS#73
mhlavac wants to merge 1 commit into
Superbalist:masterfrom
mhlavac:can-overwrite

Conversation

@mhlavac

@mhlavac mhlavac commented Jan 12, 2018

Copy link
Copy Markdown

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
Copy Markdown

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.

2 participants