Example #1
0
 /**
  * Adds the commands needed for the increment 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
  */
 private function addMultiExecIncrement(MultiExecContext $multi, $subject, $bucket)
 {
     // Increment the current bucket
     $multi->hincrby($subject, $bucket, 1);
     // Clear the buckets ahead
     $multi->hdel($subject, ($bucket + 1) % $this->bucketCount)->hdel($subject, ($bucket + 2) % $this->bucketCount);
     // Renew the key TTL
     $multi->expire($subject, $this->subjectExpiry);
 }