Cache constructor (this is a singleton).
public static singleton ( ) : CacheFS | ||
Résultat | CacheFS | The cache singleton. |
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 function teststartCallbackFS() { $cache = CacheFilesystem::singleton(); if ($cache->isEnabled()) { $this->_startcallback($cache); } }
/** * Clears all cache classes. * @codeCoverageIgnore */ public static function clearAll() { $caches = [\Cachearium\Backend\CacheRAM::singleton(), \Cachearium\Backend\CacheFilesystem::singleton(), \Cachearium\Backend\CacheMemcached::singleton()]; foreach ($caches as $cacheInst) { if ($cacheInst->isEnabled()) { $cacheInst->clear(); } } }
public function testClearFS() { $cache = CacheFilesystem::singleton(); $this->setBigClean($cache); }