Пример #1
0
 /**
  * @return \Piwik\Cache\Lazy
  */
 private static function getCache()
 {
     if (is_null(self::$cache)) {
         self::$cache = PiwikCache::getLazyCache();
     }
     return self::$cache;
 }
Пример #2
0
 public function test_onSiteDeleted_shouldClearSiteCache()
 {
     $cache = Cache::getLazyCache();
     $cache->save($this->siteId, 'testcontent');
     $this->manager->onSiteDeleted($this->siteId);
     $this->assertFalse($cache->contains($this->siteId));
 }
Пример #3
0
 public function test_flushAll_shouldActuallyFlushAllCaches()
 {
     $cache1 = Cache::getTransientCache();
     $cache2 = Cache::getLazyCache();
     $cache3 = Cache::getEagerCache();
     $cache1->save('test1', 'content');
     $cache2->save('test2', 'content');
     $cache3->save('test3', 'content');
     $this->assertTrue($cache1->contains('test1'));
     $this->assertTrue($cache2->contains('test2'));
     $this->assertTrue($cache3->contains('test3'));
     Cache::flushAll();
     $this->assertFalse($cache1->contains('test1'));
     $this->assertFalse($cache2->contains('test2'));
     $this->assertFalse($cache3->contains('test3'));
 }
 private function buildCache()
 {
     return Cache::getLazyCache();
 }
Пример #5
0
 private static function getCache()
 {
     return Cache::getLazyCache();
 }
Пример #6
0
 public function clearInMemoryCaches()
 {
     Archive::clearStaticCache();
     DataTableManager::getInstance()->deleteAll();
     Option::clearCache();
     Site::clearCache();
     Cache::deleteTrackerCache();
     PiwikCache::getTransientCache()->flushAll();
     PiwikCache::getEagerCache()->flushAll();
     PiwikCache::getLazyCache()->flushAll();
     ArchiveTableCreator::clear();
     \Piwik\Plugins\ScheduledReports\API::$cache = array();
     Singleton::clearAll();
     PluginsArchiver::$archivers = array();
     $_GET = $_REQUEST = array();
     Translate::reset();
     self::getConfig()->Plugins;
     // make sure Plugins exists in a config object for next tests that use Plugin\Manager
     // since Plugin\Manager uses getFromGlobalConfig which doesn't init the config object
 }
Пример #7
0
 public function __construct(MetricsProvider $provider)
 {
     $this->provider = $provider;
     $this->cache = Cache::getLazyCache();
 }