PHP code example of xtain / symfony-lock-flysystem
1. Go to this page and download the library: Download xtain/symfony-lock-flysystem library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xtain / symfony-lock-flysystem example snippets
use XTAIN\Flysystem\Lock\FlysystemStore;
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
use Symfony\Component\Lock\Factory;
$filesystem = new Filesystem(new Local(sys_get_temp_dir()));
$factory = new Factory(new FlysystemStore($filesystem));
$lock = $factory->createLock('test', 5);
$lock->acquire();
sleep(4);
$lock->refresh();
sleep(4);
$lock->refresh();
$lock->isExpired() === false;