Ejemplo n.º 1
0
 public function testFillWithFillRate()
 {
     $this->tokenBucket->setOptions(array('capacity' => 100, 'fillRate' => 10));
     $this->storage->set($this->tokenBucket->getBucketKey(), array('count' => 50, 'time' => time(), 'reset' => time() + 15), $this->tokenBucket->getTtl());
     sleep(1);
     $this->tokenBucket->fill();
     $bucketArray = $this->tokenBucket->getBucket();
     $this->assertEquals(60, $bucketArray['count'], 'Fill does not work');
 }
Ejemplo n.º 2
0
 public function save()
 {
     $this->storage->set($this->bucketKey, $this->bucket);
 }