/** * {@inheritdoc} */ public function increment($counter, $value = 1) { $counter = $this->transformCounter($counter); $counter = new Counter($counter->getName(), $counter->getValue() + $value); $this->setCounter($counter); return $counter; }
/** * {@inheritdoc} */ public function setCounter(Counter $counter) { $file = $this->getCacheKey($counter->getName()); $this->filesystem->mkdir(dirname($file)); file_put_contents($file, $counter->getValue()); return $counter; }
/** * {@inheritdoc} */ public function setCounter(Counter $counter) { $key = $this->getCacheKey($counter->getName()); apc_store($key, $counter->getValue()); return $counter; }
public function testCounter() { $counter = new Counter('foo', 42); $this->assertEquals('foo', $counter->getName()); $this->assertEquals(42, $counter->getValue()); }
/** * {@inheritdoc} */ public function setCounter(Counter $counter) { $cmd = $this->client->createCommand('set', array($counter->getName(), $counter->getValue())); $this->client->executeCommand($cmd); return $counter; }