src/Adapters/Flysystem.php
protected function lock($key)
    {
        $path = $key.'.lock';

        for ($i = 0; $i < 25; ++$i) {
            try {
                $this->filesystem->write($path, '');

                return true;
            } catch (FileExistsException $e) {
                usleep(200);
            }
        }

        return false;
    }
protected function lock($key)
    {
        $path = $key.'.lock';

        for ($i = 0; $i < 25; ++$i) {
            try {
                $this->filesystem->write($path, '');

                return true;
            } catch (FileExistsException $e) {
                usleep(200);
            }
        }

        return false;
    }
protected function lock ( $ key ) { $ path = $ key . '.lock' ; for ( $ i = 0 ; $ i < 25 ; ++ $ i ) { try { $ this -> filesystem -> write ( $ path , '' ) ; return true ; } catch ( FileExistsException $ e ) { usleep ( 200 ) ; } } return false ; }
Obtain a lock for a given key.
It'll try to get a lock for a couple of times, but ultimately give up if
no lock can be obtained in a reasonable time.

@param string $key

@return bool
Obtain a lock for a given key . It ll try to get a lock for a couple of times but ultimately give up if no lock can be obtained in a reasonable time .