lyoshenka/php-simple-lock

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

A simple PHP advisory lock implementation. Uses flock() internally.

1.0 2015-01-19 19:39 UTC

This package is not auto-updated.

Last update: 2024-12-21 18:53:05 UTC


README

Install

"require": {
  "lyoshenka/php-simple-lock": "~1.0"
}

or from the command-line:

composer require lyoshenka/php-simple-lock

Usage

use SimpleLock\Lock;

$lock = Lock::acquire('lockname');
if ($lock)
{
  // lock acquired. protected code goes here.

  Lock::release($lock);
}

If you want to change the location where lockfiles are stored:

Lock::setLockDir('/path/to/lock/dir');

Bugs/Fixes

File issues here, submit pull requests, or email me: alex@grin.io