Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@googlemail.com>2014-12-17 00:25:51 +0300
committerThomas Steur <thomas.steur@googlemail.com>2014-12-17 00:25:51 +0300
commit1634607051341f6d348404cd4bc478cf2474a259 (patch)
tree8893897d8cdb2b5313a3a2f3f6fac39ce1b56755 /core/WidgetsList.php
parentc0f24c160ab2f573a06146c66fa7fc7bab97a3a7 (diff)
added support for different caching backends such as redis
Diffstat (limited to 'core/WidgetsList.php')
-rw-r--r--core/WidgetsList.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/core/WidgetsList.php b/core/WidgetsList.php
index 943dfceb68..c474061606 100644
--- a/core/WidgetsList.php
+++ b/core/WidgetsList.php
@@ -8,7 +8,7 @@
*/
namespace Piwik;
-use Piwik\Cache\PluginAwareStaticCache;
+use Piwik\Cache as PiwikCache;
use Piwik\Plugin\Report;
use Piwik\Plugin\Widgets;
@@ -63,9 +63,11 @@ class WidgetsList extends Singleton
*/
public static function get()
{
- $cache = self::getCacheForCompleteList();
- if (!self::$listCacheToBeInvalidated && $cache->has()) {
- return $cache->get();
+ $cache = self::getCacheForCompleteList();
+ $cacheId = self::getCacheId();
+
+ if (!self::$listCacheToBeInvalidated && $cache->contains($cacheId)) {
+ return $cache->fetch($cacheId);
}
self::addWidgets();
@@ -83,7 +85,7 @@ class WidgetsList extends Singleton
$widgets[$category] = $v;
}
- $cache->set($widgets);
+ $cache->save($cacheId, $widgets);
self::$listCacheToBeInvalidated = false;
return $widgets;
@@ -270,11 +272,16 @@ class WidgetsList extends Singleton
{
self::$widgets = array();
self::$hookCalled = false;
- self::getCacheForCompleteList()->clear();
+ self::getCacheForCompleteList()->delete(self::getCacheId());
+ }
+
+ private static function getCacheId()
+ {
+ return CacheId::pluginAware('WidgetsList');
}
private static function getCacheForCompleteList()
{
- return new PluginAwareStaticCache('WidgetsList');
+ return PiwikCache::getTransientCache();
}
}