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/CacheId.php | |
parent | c0f24c160ab2f573a06146c66fa7fc7bab97a3a7 (diff) |
added support for different caching backends such as redis
Diffstat (limited to 'core/CacheId.php')
-rw-r--r-- | core/CacheId.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/core/CacheId.php b/core/CacheId.php new file mode 100644 index 0000000000..e445424009 --- /dev/null +++ b/core/CacheId.php @@ -0,0 +1,30 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik; + +use Piwik\Translate; +use Piwik\Plugin\Manager; + +class CacheId +{ + public static function languageAware($cacheId) + { + return $cacheId . '-' . Translate::getLanguageLoaded(); + } + + public static function pluginAware($cacheId) + { + $pluginManager = Manager::getInstance(); + $pluginNames = $pluginManager->getLoadedPluginsName(); + $cacheId = $cacheId . '-' . md5(implode('', $pluginNames)); + $cacheId = self::languageAware($cacheId); + + return $cacheId; + } +} |