PHP Class malkusch\lock\mutex\PHPRedisMutex

This implementation requires at least phpredis-2.2.4. Note: If you're going to use this mutex in a forked process, you have to call {@link seedRandom()} in each instance.
Author: Markus Malkusch ([email protected])
Inheritance: extends RedisMutex
Show file Open project: malkusch/lock

Public Methods

Method Description
__construct ( array $redisAPIs, string $name, integer $timeout = 3 ) Sets the connected Redis APIs.

Protected Methods

Method Description
add ( $redis, $key, $value, $expire )
evalScript ( $redis, $script, $numkeys, array $arguments )
getRedisIdentifier ( $redis )

Method Details

__construct() public method

The Redis APIs needs to be connected yet. I.e. Redis::connect() was called already.
public __construct ( array $redisAPIs, string $name, integer $timeout = 3 )
$redisAPIs array The Redis connections.
$name string The lock name.
$timeout integer The time in seconds a lock expires, default is 3.

add() protected method

protected add ( $redis, $key, $value, $expire )

evalScript() protected method

protected evalScript ( $redis, $script, $numkeys, array $arguments )
$arguments array

getRedisIdentifier() protected method

protected getRedisIdentifier ( $redis )