Example #1
0
 /**
  * Adds the commands needed for the count function
  *
  * @param MultiExecContext $multi   A MultiExecContext instance
  * @param string           $subject A unique identifier, for example a session id or an IP
  * @param int              $bucket  Bucket
  * @param int              $count   Count
  */
 private function addMultiExecCount(MultiExecContext $multi, $subject, $bucket, $count)
 {
     // Get the counts from the previous `$count` buckets
     $multi->hget($subject, $bucket);
     while ($count--) {
         $multi->hget($subject, (--$bucket + $this->bucketCount) % $this->bucketCount);
     }
 }