function testVolume() { $testDir = "/tmp/testdir"; if (!is_dir($testDir)) { mkdir($testDir); } $config = array('cache' => array('file' => array('directory' => $testDir))); $cache = new HandsetDetection\HDCache($config); $now = time(); for ($i = 0; $i < $this->volumeTest; $i++) { $key = 'test' . $now . $i; // Write $reply = $cache->write($key, $this->testData); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertEquals($this->testData, $reply); // Delete $reply = $cache->delete($key); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertNull($reply); } $end = time(); $cache->purge(); }
function testVolume() { $cache = new HandsetDetection\HDCache(); $now = time(); // Skip tests if no cache installed if ($cache->getName() == 'none') { $this->markTestSkipped('No cache configured/installed'); return; } for ($i = 0; $i < $this->volumeTest; $i++) { $key = 'test' . $now . $i; // Write $reply = $cache->write($key, $this->testData); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertEquals($this->testData, $reply); // Delete $reply = $cache->delete($key); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertNull($reply); } $end = time(); $cache->purge(); }
function testVolume() { $cache = new HandsetDetection\HDCache(); $keys = array(); $now = time(); for ($i = 0; $i < 10000; $i++) { $key = 'test' . $now . $i; $cache->write($key, $this->testData); } for ($i = 0; $i < 10000; $i++) { $key = 'test' . $now . $i; $reply = $cache->read($key); $this->assertEquals($this->testData, $reply); } }
function testVolume() { $cache = new HandsetDetection\HDCache(); $now = time(); for ($i = 0; $i < $this->volumeTest; $i++) { $key = 'test' . $now . $i; // Write $reply = $cache->write($key, $this->testData); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertEquals($this->testData, $reply); // Delete $reply = $cache->delete($key); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertNull($reply); } $end = time(); $cache->purge(); }
function testPoolVolume() { $config = array('cache' => array('memcached' => array('pool' => 'mypool', 'options' => '', 'servers' => array(array('localhost', '11211'))))); $cache = new HandsetDetection\HDCache($config); $now = time(); for ($i = 0; $i < $this->volumeTest; $i++) { $key = 'test' . $now . $i; // Write $reply = $cache->write($key, $this->testData); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertEquals($this->testData, $reply); // Delete $reply = $cache->delete($key); $this->assertTrue($reply); // Read $reply = $cache->read($key); $this->assertNull($reply); } $end = time(); $cache->purge(); }
function testVolume() { $config = array('cache' => array('none' => true)); $cache = new HandsetDetection\HDCache($config); $now = time(); for ($i = 0; $i < $this->volumeTest; $i++) { $key = 'test' . $now . $i; // Write $reply = $cache->write($key, $this->testData); $this->assertFalse($reply); // Read $reply = $cache->read($key); $this->assertFalse($reply); // Delete $reply = $cache->delete($key); $this->assertFalse($reply); // Read $reply = $cache->read($key); $this->assertFalse($reply); } $end = time(); $cache->purge(); }