nona-creative / pid-manager

用于锁定PHP文件执行的PID管理器

v0.1.3 2015-12-17 06:37 UTC

This package is not auto-updated.

Last update: 2024-09-13 15:59:51 UTC


README

用于锁定PHP文件执行的PID管理器。

安装

安装最新版本

composer require nona-creative/pid-manager

基本用法

<?php

$pidManager = new \Nona\PidManager('test.lock', './');

$pidManager->withLock(function() {
    // Do your processing here
    // ...
});
<?php

$pidManager = new \Nona\PidManager('test.lock', './');

if (!$pidManager->isLocked()) {
    try {
        $pidManager->lock();

        // Do your processing here
        // ...
    } finally {
        $pidManager->unlock();
    }
}