xtain/symfony-lock-flysystem

There is no license information available for the latest version (v0.9.1) of this package.

Flysystem implementation for symfony/lock component

v0.9.1 2018-07-30 11:12 UTC

This package is auto-updated.

Last update: 2024-11-10 05:19:38 UTC


README

This adapter allows you to use any flysystem filesystem instance as store for the symfony/lock component.

Installation

composer require xtain/symfony-lock-flysystem

Usage

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;