Skip to content

newclass-pl/claudo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

license PHP 5.6+

What is Claudo?

Claudo is a PHP semaphore system. Helper for async execute code.

Installation

The best way to install is to use the composer by command:

composer require newclass/claudo
composer install

Use example

use Claudo\Semaphore;
use Claudo\SemaphoreBatch;

$semaphoreBatch = new SemaphoreBatch();

$semaphoreBatch->add(new Semaphore('test1', '.'));
$semaphoreBatch->add(new Semaphore('test2'));

$result = $semaphoreBatch->synchronize(function (Semaphore $semaphore) {
    $var = $semaphore->get('var', null);
    if (!$var) {
        $var = 0;
    }

    ++$var;

    $semaphore->set('var', $var);

    return sprintf('finish: %s, result: %d',$semaphore->getName(),$var);
});

echo $result;

About

Semaphore system for php.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages