rych / lock
Simple lockfile management class.
1.0.0
2014-07-16 01:08 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- mikey179/vfsstream: 1.2.*
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-12-23 11:51:12 UTC
README
Simple process lock management library.
Installation
Installation is best managed via Composer.
{ "require": { "rych/lock": "1.0.*" } }
Or:
composer require rych/lock=1.0.*
Usage
<?php $lock = new \Rych\Lock\Lock("lock-name", "/path/to/locks"); if ($lock->lock()) { // Do work here } else { die ("Unable to acquire lock! Make sure no other process is running!"); } $lock->unlock();
Methods
- bool \Rych\Lock\Lock::__construct( string $name [, string $bucket = null ] )
- bool \Rych\Lock\Lock::lock( [ bool $block = false ] )
- bool \Rych\Lock\Lock::unlock()
- bool \Rych\Lock\Lock::check( [ string &$pidof = null ] )