clearAll() public static method

Clears all cache classes.
public static clearAll ( )
Beispiel #1
0
 public static function setUpBeforeClass()
 {
     global $FLOH_CONFIG;
     self::$testMemoryCache = true;
     // CONF('LH_CACHE_ENABLE') && CONF('LH_CACHE_MEMCACHE');
     self::$enabled = true;
     // CONF('LH_CACHE_ENABLE');
     $FLOH_CONFIG['LH_CACHE_DEBUG_ONPAGE'] = false;
     if (!self::$enabled) {
         self::markTestSkipped('CacheAbstract disabled');
     } else {
         CacheMemcached::singleton([['localhost', 11211]]);
         // set server
         CacheAbstract::clearAll();
     }
 }
 public function testClearAll()
 {
     $cacheKey = new CacheKey('test', 1);
     $cacheData = new CacheData($cacheKey, 'test');
     $caches = [CacheRAM::singleton(), CacheFilesystem::singleton()];
     if (CacheMemcached::hasMemcachedExt()) {
         $caches[] = CacheMemcached::singleton();
     }
     foreach ($caches as $cacheInst) {
         $cacheInst->enable()->storeData($cacheData);
         $retrievedData = $cacheInst->getData($cacheKey);
         $this->assertEquals($cacheData->getFirstData(), $retrievedData->getFirstData());
     }
     CacheAbstract::clearAll();
     foreach ($caches as $cacheInst) {
         try {
             $retrievedData = $cacheInst->getData($cacheKey);
             $this->fail('Cache should be empty after a clearAll call !');
         } catch (\Cachearium\Exceptions\NotCachedException $e) {
             $this->assertTrue(true, 'All cache was cleaned');
         }
     }
 }
 public static function setUpBeforeClass()
 {
     CacheMemcached::singleton()->addServers([['localhost', 11211]]);
     // init server
     CacheAbstract::clearAll();
 }
 public static function setUpBeforeClass()
 {
     CacheAbstract::clearAll();
 }