Example #1
0
 /**
  * Test: Retrieve Stats from memcached daemon.
  *
  * @author Benjamin Carl <*****@*****.**>
  * @return void
  * @access protected
  */
 public function testRetrieveStats()
 {
     $stats = $this->client->stats();
     $this->assertTrue($this->client->set($this->key, $this->value));
     $this->assertEquals($this->value, $this->client->get($this->key));
     # Mostly the first key
     $this->assertArrayHasKey('pid', $stats);
     # Mostly the last key
     $this->assertArrayHasKey('evictions', $stats);
     $stats = $this->client->stats(Client::STATS_TYPE_ITEMS);
     $this->assertArrayHasKey('items', $stats);
     $stats = $this->client->stats(Client::STATS_TYPE_SLABS);
     $this->assertArrayHasKey('active_slabs', $stats);
     $this->assertGreaterThanOrEqual(1, $stats['active_slabs']);
     $slabs = $stats['active_slabs'];
     $cachedump = array();
     for ($i = 1; $i <= $slabs; ++$i) {
         $cachedumpTemp = $this->client->stats(Client::STATS_TYPE_CACHEDUMP, $i, Client::CACHEDUMP_ITEMS_MAX);
         $cachedump = array_merge_recursive($cachedump, $cachedumpTemp);
     }
     $this->assertArrayHasKey($this->key, $cachedump);
 }