public function testIncrementDecrementKey() { $client = new Client(array('c1' => array(array('name' => 'local1', 'host' => 'localhost', 'port' => 11200))), 'MemcachedManager\\Tests\\Fixtures\\MockMemcached'); $client->addKey('c1', 'k-test', 12); $expected = new Key(); $expected->setKey('k-test'); $expected->setValue(12); $this->assertEquals($expected, $client->getKey('c1', Hash::encode('k-test'))); $client->incrementKey('c1', Hash::encode('k-test')); $client->incrementKey('c1', Hash::encode('k-test')); $expected->setValue(14); $this->assertEquals($expected, $client->getKey('c1', Hash::encode('k-test'))); $client->decrementKey('c1', Hash::encode('k-test')); $expected->setValue(13); $this->assertEquals($expected, $client->getKey('c1', Hash::encode('k-test'))); }
/** * Proxy function for decrementing a key's value in the data source * * @param $clusterName * @param $key */ public function decrementKey($clusterName, $key) { $cluster = $this->getCluster($clusterName); $client = $this->processNodes($this->getClient(), $cluster->getNodes()); $client->decrementKey(Hash::decode($key)); }
/** * @param string $key */ public function setKey($key) { $this->key = $key; $this->hash = Hash::encode($key); }
public function testDecode() { $this->assertEquals('is it still snowing?', Hash::decode('F1rLAG_caKql7vEQl-gj1g82_AIyxuAQt1rOX4-K7nQ=')); }