getLogSummary() 공개 정적인 메소드

Returns basic cache statistics. See $summary.
public static getLogSummary ( ) : array()
리턴 array()
예제 #1
0
 private function setGetClean(CacheAbstract $cache)
 {
     $base = 'base';
     // enable
     $this->assertTrue($cache->isEnabled());
     $cache->setEnabled(false);
     $this->assertFalse($cache->isEnabled());
     $cache->setEnabled(true);
     $this->assertTrue($cache->isEnabled());
     $cache->disable();
     $this->assertFalse($cache->isEnabled());
     $cache->enable();
     $this->assertTrue($cache->isEnabled());
     $cache->setDefaultLifetime(3600);
     $this->assertEquals(3600, $cache->getDefaultLifetime());
     $key1 = new CacheKey($base, 1);
     $cache->clean($key1);
     try {
         $data = $cache->get($key1);
         $this->fail();
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->assertTrue(true);
     }
     $retval = $cache->store(234, $key1);
     $this->assertTrue($retval);
     try {
         $data = $cache->get($key1);
         $this->assertEquals(234, $data);
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->fail();
     }
     // sleep(1);
     try {
         $data = $cache->get($key1);
         $this->assertEquals(234, $data);
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->fail();
     }
     $cache->clean($key1);
     try {
         $data = $cache->get($key1);
         $this->fail();
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->assertTrue(true);
     }
     $key2 = new CacheKey($base, 2, 'a');
     $key3 = new CacheKey($base, 3, 'a');
     // now change again and delete
     $retval = $cache->store(234, $key2);
     $this->assertEquals(true, $retval);
     try {
         $data = $cache->get($key2);
         $this->assertEquals(234, $data);
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->fail();
     }
     $this->assertTrue($cache->delete($key2));
     // test null
     $retval = $cache->store(null, $key3);
     $this->assertEquals(true, $retval);
     try {
         $data = $cache->get($key3);
         $this->assertEquals(null, $data);
     } catch (Cachearium\Exceptions\NotCachedException $e) {
         $this->fail();
     }
     $this->assertTrue($cache->delete($key3));
     $this->assertArrayHasKey(CacheLogEnum::ACCESSED, $cache->getLogSummary());
     $this->assertGreaterThan(0, $cache->getLogSummary()[CacheLogEnum::ACCESSED]);
 }