Resque\Helpers\Stats::decr PHP Method

decr() public static method

Decrement the value of the specified statistic by a certain amount (default is -1)
public static decr ( string $stat, integer $by = 1, string $key = Stats::DEFAULT_KEY ) : boolean
$stat string The name of the statistic to decrement.
$by integer The amount to decrement the statistic by.
$key string The stat key to use
return boolean True if successful, false if not.
    public static function decr($stat, $by = 1, $key = Stats::DEFAULT_KEY)
    {
        return (bool) Redis::instance()->hincrby($key, $stat, -1 * $by);
    }

Usage Example

Example #1
0
 /**
  * Mark the current job stopped
  * This is an internal function as the job is either completed, cancelled or failed
  */
 protected function stopped()
 {
     $this->redis->zrem(Queue::redisKey($this->queue, 'running'), $this->payload);
     Stats::decr('running', 1);
     Stats::decr('running', 1, Queue::redisKey($this->queue, 'stats'));
 }
All Usage Examples Of Resque\Helpers\Stats::decr