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/Dimension | |
parent | c0f24c160ab2f573a06146c66fa7fc7bab97a3a7 (diff) |
added support for different caching backends such as redis
Diffstat (limited to 'core/Plugin/Dimension')
-rw-r--r-- | core/Plugin/Dimension/ActionDimension.php | 12 | ||||
-rw-r--r-- | core/Plugin/Dimension/ConversionDimension.php | 12 | ||||
-rw-r--r-- | core/Plugin/Dimension/VisitDimension.php | 12 |
3 files changed, 21 insertions, 15 deletions
diff --git a/core/Plugin/Dimension/ActionDimension.php b/core/Plugin/Dimension/ActionDimension.php index bc09b01fc3..f0daaf547c 100644 --- a/core/Plugin/Dimension/ActionDimension.php +++ b/core/Plugin/Dimension/ActionDimension.php @@ -8,7 +8,8 @@ */ namespace Piwik\Plugin\Dimension; -use Piwik\Cache\PluginAwareStaticCache; +use Piwik\CacheId; +use Piwik\Cache as PiwikCache; use Piwik\Columns\Dimension; use Piwik\Plugin\Manager as PluginManager; use Piwik\Plugin\Segment; @@ -212,9 +213,10 @@ abstract class ActionDimension extends Dimension */ public static function getAllDimensions() { - $cache = new PluginAwareStaticCache('ActionDimensions'); + $cacheId = CacheId::pluginAware('ActionDimensions'); + $cache = PiwikCache::getTransientCache(); - if (!$cache->has()) { + if (!$cache->contains($cacheId)) { $plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated(); $instances = array(); @@ -225,10 +227,10 @@ abstract class ActionDimension extends Dimension } } - $cache->set($instances); + $cache->save($cacheId, $instances); } - return $cache->get(); + return $cache->fetch($cacheId); } /** diff --git a/core/Plugin/Dimension/ConversionDimension.php b/core/Plugin/Dimension/ConversionDimension.php index 7cf2a813c0..34a8006111 100644 --- a/core/Plugin/Dimension/ConversionDimension.php +++ b/core/Plugin/Dimension/ConversionDimension.php @@ -8,7 +8,8 @@ */ namespace Piwik\Plugin\Dimension; -use Piwik\Cache\PluginAwareStaticCache; +use Piwik\CacheId; +use Piwik\Cache as PiwikCache; use Piwik\Columns\Dimension; use Piwik\Plugin\Manager as PluginManager; use Piwik\Common; @@ -155,9 +156,10 @@ abstract class ConversionDimension extends Dimension */ public static function getAllDimensions() { - $cache = new PluginAwareStaticCache('ConversionDimensions'); + $cacheId = CacheId::pluginAware('ConversionDimensions'); + $cache = PiwikCache::getTransientCache(); - if (!$cache->has()) { + if (!$cache->contains($cacheId)) { $plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated(); $instances = array(); @@ -168,10 +170,10 @@ abstract class ConversionDimension extends Dimension } } - $cache->set($instances); + $cache->save($cacheId, $instances); } - return $cache->get(); + return $cache->fetch($cacheId); } /** diff --git a/core/Plugin/Dimension/VisitDimension.php b/core/Plugin/Dimension/VisitDimension.php index b9aa3a9b2a..97dfd6f57b 100644 --- a/core/Plugin/Dimension/VisitDimension.php +++ b/core/Plugin/Dimension/VisitDimension.php @@ -8,7 +8,8 @@ */ namespace Piwik\Plugin\Dimension; -use Piwik\Cache\PluginAwareStaticCache; +use Piwik\CacheId; +use Piwik\Cache as PiwikCache; use Piwik\Columns\Dimension; use Piwik\Common; use Piwik\Db; @@ -294,9 +295,10 @@ abstract class VisitDimension extends Dimension */ public static function getAllDimensions() { - $cache = new PluginAwareStaticCache('VisitDimensions'); + $cacheId = CacheId::pluginAware('VisitDimensions'); + $cache = PiwikCache::getTransientCache(); - if (!$cache->has()) { + if (!$cache->contains($cacheId)) { $plugins = PluginManager::getInstance()->getPluginsLoadedAndActivated(); $instances = array(); @@ -309,10 +311,10 @@ abstract class VisitDimension extends Dimension usort($instances, array('self', 'sortByRequiredFields')); - $cache->set($instances); + $cache->save($cacheId, $instances); } - return $cache->get(); + return $cache->fetch($cacheId); } /** |