Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 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();
     $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();
 }
Esempio n. 4
0
 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();
 }
Esempio n. 5
0
 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();
 }