PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.0.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.0.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / core / Cache.php
matomo / app / core Last commit date
API 5 years ago Access 5 years ago Application 5 years ago Archive 5 years ago ArchiveProcessor 5 years ago Archiver 5 years ago AssetManager 5 years ago Auth 5 years ago Category 5 years ago CliMulti 5 years ago Columns 5 years ago Composer 5 years ago Concurrency 5 years ago Config 5 years ago Container 5 years ago CronArchive 5 years ago DataAccess 5 years ago DataFiles 5 years ago DataTable 5 years ago Db 5 years ago DeviceDetector 5 years ago Email 5 years ago Exception 5 years ago Http 5 years ago Intl 5 years ago Mail 5 years ago Measurable 5 years ago Menu 5 years ago Metrics 5 years ago Notification 5 years ago Period 5 years ago Plugin 5 years ago ProfessionalServices 5 years ago Report 5 years ago ReportRenderer 5 years ago Scheduler 5 years ago Segment 5 years ago Session 5 years ago Settings 5 years ago Tracker 5 years ago Translation 5 years ago UpdateCheck 5 years ago Updater 5 years ago Updates 5 years ago Validators 5 years ago View 5 years ago ViewDataTable 5 years ago Visualization 5 years ago Widget 5 years ago .htaccess 6 years ago Access.php 5 years ago Archive.php 5 years ago ArchiveProcessor.php 5 years ago AssetManager.php 5 years ago Auth.php 5 years ago AuthResult.php 5 years ago BaseFactory.php 5 years ago Cache.php 5 years ago CacheId.php 5 years ago CliMulti.php 5 years ago Common.php 5 years ago Config.php 5 years ago Console.php 5 years ago Context.php 5 years ago Cookie.php 5 years ago CronArchive.php 5 years ago DataArray.php 5 years ago DataTable.php 5 years ago Date.php 5 years ago Db.php 5 years ago DbHelper.php 5 years ago Development.php 5 years ago ErrorHandler.php 5 years ago EventDispatcher.php 5 years ago ExceptionHandler.php 5 years ago FileIntegrity.php 5 years ago Filechecks.php 5 years ago Filesystem.php 5 years ago FrontController.php 5 years ago Http.php 5 years ago IP.php 5 years ago Log.php 5 years ago LogDeleter.php 5 years ago Mail.php 5 years ago Metrics.php 5 years ago NoAccessException.php 5 years ago Nonce.php 5 years ago Notification.php 5 years ago NumberFormatter.php 5 years ago Option.php 5 years ago Period.php 5 years ago Piwik.php 5 years ago Plugin.php 5 years ago Profiler.php 5 years ago ProxyHeaders.php 5 years ago ProxyHttp.php 5 years ago QuickForm2.php 5 years ago RankingQuery.php 5 years ago ReportRenderer.php 5 years ago Segment.php 5 years ago Sequence.php 5 years ago Session.php 5 years ago SettingsPiwik.php 5 years ago SettingsServer.php 5 years ago Singleton.php 5 years ago Site.php 5 years ago TCPDF.php 5 years ago Theme.php 5 years ago Timer.php 5 years ago Tracker.php 5 years ago Twig.php 5 years ago Unzip.php 5 years ago UpdateCheck.php 5 years ago Updater.php 5 years ago UpdaterErrorException.php 5 years ago Updates.php 5 years ago Url.php 5 years ago UrlHelper.php 5 years ago Version.php 5 years ago View.php 5 years ago bootstrap.php 5 years ago dispatch.php 5 years ago testMinimumPhpVersion.php 5 years ago
Cache.php
117 lines
1 <?php
2 /**
3 * Matomo - free/libre analytics platform
4 *
5 * @link https://matomo.org
6 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7 *
8 */
9 namespace Piwik;
10
11 use Piwik\Container\StaticContainer;
12
13 class Cache
14 {
15
16 /**
17 * This can be considered as the default cache to use in case you don't know which one to pick. It does not support
18 * the caching of any objects though. Only boolean, numbers, strings and arrays are supported. Whenever you request
19 * an entry from the cache it will fetch the entry. Cache entries might be persisted but not necessarily. It
20 * depends on the configured backend.
21 *
22 * @return \Matomo\Cache\Lazy
23 */
24 public static function getLazyCache()
25 {
26 return StaticContainer::get('Matomo\Cache\Lazy');
27 }
28
29 /**
30 * This class is used to cache any data during one request. It won't be persisted between requests and it can
31 * cache all kind of data, even objects or resources. This cache is very fast.
32 *
33 * @return \Matomo\Cache\Transient
34 */
35 public static function getTransientCache()
36 {
37 return StaticContainer::get('Matomo\Cache\Transient');
38 }
39
40 /**
41 * This cache stores all its cache entries under one "cache" entry in a configurable backend.
42 *
43 * This comes handy for things that you need very often, nearly in every request. For example plugin metadata, the
44 * list of tracker plugins, the list of available languages, ...
45 * Instead of having to read eg. a hundred cache entries from files (or any other backend) it only loads one cache
46 * entry which contains the hundred keys. Should be used only for things that you need very often and only for
47 * cache entries that are not too large to keep loading and parsing the single cache entry fast.
48 * All cache entries it contains have the same life time. For fast performance it won't validate any cache ids.
49 * It is not possible to cache any objects using this cache.
50 *
51 * @return \Matomo\Cache\Eager
52 */
53 public static function getEagerCache()
54 {
55 return StaticContainer::get('Matomo\Cache\Eager');
56 }
57
58 public static function flushAll()
59 {
60 self::getLazyCache()->flushAll();
61 self::getTransientCache()->flushAll();
62 self::getEagerCache()->flushAll();
63 }
64
65 /**
66 * @param $type
67 * @return \Matomo\Cache\Backend
68 */
69 public static function buildBackend($type)
70 {
71 $factory = new \Matomo\Cache\Backend\Factory();
72 $options = self::getOptions($type);
73
74 $backend = $factory->buildBackend($type, $options);
75
76 return $backend;
77 }
78
79 private static function getOptions($type)
80 {
81 $options = self::getBackendOptions($type);
82
83 switch ($type) {
84 case 'file':
85
86 $options = array('directory' => StaticContainer::get('path.cache'));
87 break;
88
89 case 'chained':
90
91 foreach ($options['backends'] as $backend) {
92 $options[$backend] = self::getOptions($backend);
93 }
94
95 break;
96
97 case 'redis':
98
99 if (!empty($options['timeout'])) {
100 $options['timeout'] = (float)Common::forceDotAsSeparatorForDecimalPoint($options['timeout']);
101 }
102
103 break;
104 }
105
106 return $options;
107 }
108
109 private static function getBackendOptions($backend)
110 {
111 $key = ucfirst($backend) . 'Cache';
112 $options = Config::getInstance()->$key;
113
114 return $options;
115 }
116 }
117