decr() 공개 정적인 메소드

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
리턴 boolean True if successful, false if not.
예제 #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'));
 }
예제 #2
0
 /**
  * Find any delayed jobs and add them to the queue if found
  *
  * @param int $endTime optional end time for range
  * @param int $startTime optional start time for range
  */
 public function queueDelayed($endTime = null, $startTime = 0)
 {
     $startTime = $startTime ?: 0;
     $endTime = $endTime ?: time();
     foreach ($this->resolveQueues() as $queue) {
         $this->redis->multi();
         $jobs = $this->redis->zrangebyscore(Queue::redisKey($queue, 'delayed'), $startTime, $endTime);
         $this->redis->zremrangebyscore(Queue::redisKey($queue, 'delayed'), $startTime, $endTime);
         list($jobs, $found) = $this->redis->exec();
         if ($found > 0) {
             foreach ($jobs as $payload) {
                 $job = Job::loadPayload($queue, $payload);
                 $job->setWorker($this);
                 if (Event::fire(Event::JOB_QUEUE_DELAYED, $job) !== false) {
                     $job->queue();
                     Event::fire(Event::JOB_QUEUED_DELAYED, $job);
                 }
             }
             Stats::decr('delayed', $found);
             Stats::decr('delayed', $found, Queue::redisKey($queue, 'stats'));
             $this->log('Added <pop>' . $found . '</pop> delayed job' . ($found == 1 ? '' : 's') . ' to <pop>' . $queue . '</pop> queue', Logger::NOTICE);
         }
     }
 }