$this->lockTTL = $met ? 2 * $met : 3600;
if ( self::$active === null ) {
- self::$active = array();
- register_shutdown_function( array( __CLASS__, 'releaseAll' ) );
+ self::$active = [];
+ register_shutdown_function( [ __CLASS__, 'releaseAll' ] );
}
}
try {
$conn->luaEval( $script,
- array(
+ [
$this->getSlotListKey(),
$this->getSlotRTimeSetKey(),
$this->getWakeupListKey(),
$this->slotTime, // used for CAS-style sanity check
( $this->onRelease === self::AWAKE_ALL ) ? 1 : 0,
microtime( true )
- ),
+ ],
4 # number of first argument(s) that are keys
);
} catch ( RedisException $e ) {
// This process is now registered as waiting
$keys = ( $doWakeup == self::AWAKE_ALL )
// Wait for an open slot or wake-up signal (preferring the later)
- ? array( $this->getWakeupListKey(), $this->getSlotListKey() )
+ ? [ $this->getWakeupListKey(), $this->getSlotListKey() ]
// Just wait for an actual pool slot
- : array( $this->getSlotListKey() );
+ : [ $this->getSlotListKey() ];
$res = $conn->blPop( $keys, $this->timeout );
- if ( $res === array() ) {
+ if ( $res === [] ) {
$conn->zRem( $this->getWaitSetKey(), $this->session ); // no longer waiting
return Status::newGood( PoolCounter::TIMEOUT );
}
return slot
LUA;
return $conn->luaEval( $script,
- array(
+ [
$this->getSlotListKey(),
$this->getSlotRTimeSetKey(),
$this->getWaitSetKey(),
$this->lockTTL,
$this->session,
$now
- ),
+ ],
3 # number of first argument(s) that are keys
);
}
return 1
LUA;
return $conn->luaEval( $script,
- array(
+ [
$this->getSlotListKey(),
$this->getSlotRTimeSetKey(),
$this->getWaitSetKey(),
$this->lockTTL,
$this->session,
$now
- ),
+ ],
3 # number of first argument(s) that are keys
);
}