diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-12-17 00:25:51 +0300 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-12-17 00:25:51 +0300 |
commit | 1634607051341f6d348404cd4bc478cf2474a259 (patch) | |
tree | 8893897d8cdb2b5313a3a2f3f6fac39ce1b56755 /core/Plugin/Report.php | |
parent | c0f24c160ab2f573a06146c66fa7fc7bab97a3a7 (diff) |
added support for different caching backends such as redis
Diffstat (limited to 'core/Plugin/Report.php')
-rw-r--r-- | core/Plugin/Report.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index 1824b6774f..af61a33a0a 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -10,11 +10,12 @@ namespace Piwik\Plugin; use Piwik\API\Proxy; use Piwik\API\Request; -use Piwik\Cache\LanguageAwareStaticCache; +use Piwik\CacheId; use Piwik\Columns\Dimension; use Piwik\DataTable; use Piwik\Menu\MenuReporting; use Piwik\Metrics; +use Piwik\Cache as PiwikCache; use Piwik\Piwik; use Piwik\Plugin\Manager as PluginManager; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; @@ -735,9 +736,10 @@ class Report public static function getAllReports() { $reports = self::getAllReportClasses(); - $cache = new LanguageAwareStaticCache('Reports' . implode('', $reports)); + $cacheId = CacheId::languageAware('Reports' . md5(implode('', $reports))); + $cache = PiwikCache::getTransientCache(); - if (!$cache->has()) { + if (!$cache->contains($cacheId)) { $instances = array(); foreach ($reports as $report) { @@ -746,10 +748,10 @@ class Report usort($instances, array('self', 'sort')); - $cache->set($instances); + $cache->save($cacheId, $instances); } - return $cache->get(); + return $cache->fetch($cacheId); } /** @@ -785,10 +787,10 @@ class Report foreach ($metricsToTranslate as $metric) { if ($metric instanceof Metric) { - $metricName = $metric->getName(); + $metricName = $metric->getName(); $translation = $metric->getTranslatedName(); } else { - $metricName = $metric; + $metricName = $metric; $translation = @$translations[$metric]; } |