本文整理汇总了PHP中Piwik\Cache::buildBackend方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::buildBackend方法的具体用法?PHP Cache::buildBackend怎么用?PHP Cache::buildBackend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Cache
的用法示例。
在下文中一共展示了Cache::buildBackend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
use Interop\Container\ContainerInterface;
use Piwik\Common;
use Piwik\Tests\Framework\Mock\FakeAccess;
use Piwik\Tests\Framework\Mock\TestConfig;
return array('Psr\\Log\\LoggerInterface' => DI\object('Psr\\Log\\NullLogger'), 'Piwik\\Cache\\Backend' => function () {
return \Piwik\Cache::buildBackend('file');
}, 'cache.eager.cache_id' => 'eagercache-test-', 'Piwik\\Translation\\Translator' => DI\decorate(function ($previous, ContainerInterface $c) {
$loadRealTranslations = $c->get('test.vars.loadRealTranslations');
if (!$loadRealTranslations) {
return new \Piwik\Translation\Translator($c->get('Piwik\\Translation\\Loader\\LoaderInterface'), $directories = array());
} else {
return $previous;
}
}), 'Piwik\\Config' => DI\decorate(function ($previous, ContainerInterface $c) {
$testingEnvironment = $c->get('Piwik\\Tests\\Framework\\TestingEnvironmentVariables');
$dontUseTestConfig = $c->get('test.vars.dontUseTestConfig');
if (!$dontUseTestConfig) {
$settingsProvider = $c->get('Piwik\\Application\\Kernel\\GlobalSettingsProvider');
return new TestConfig($settingsProvider, $testingEnvironment, $allowSave = false, $doSetTestEnvironment = true);
} else {
return $previous;
}
}), 'Piwik\\Access' => DI\decorate(function ($previous, ContainerInterface $c) {
$testUseMockAuth = $c->get('test.vars.testUseMockAuth');
if ($testUseMockAuth) {
$access = new FakeAccess();
FakeAccess::$superUser = true;
FakeAccess::$superUserLogin = 'superUserLogin';
return $access;
示例2: function
$instanceId = $instanceId ? '/' . $instanceId : '';
} else {
$instanceId = '';
}
return $root . '/tmp' . $instanceId;
}, 'path.cache' => DI\string('{path.tmp}/cache/tracker/'), 'Piwik\\Cache\\Eager' => function (ContainerInterface $c) {
$backend = $c->get('Piwik\\Cache\\Backend');
$cacheId = $c->get('cache.eager.cache_id');
if (SettingsServer::isTrackerApiRequest()) {
$eventToPersist = 'Tracker.end';
$cacheId .= 'tracker';
} else {
$eventToPersist = 'Request.dispatch.end';
$cacheId .= 'ui';
}
$cache = new Eager($backend, $cacheId);
\Piwik\Piwik::addAction($eventToPersist, function () use($cache) {
$cache->persistCacheIfNeeded(43200);
});
return $cache;
}, 'Piwik\\Cache\\Backend' => function (ContainerInterface $c) {
try {
$backend = $c->get('ini.Cache.backend');
} catch (NotFoundException $ex) {
$backend = 'chained';
// happens if global.ini.php is not available
}
return \Piwik\Cache::buildBackend($backend);
}, 'cache.eager.cache_id' => function () {
return 'eagercache-' . str_replace(array('.', '-'), '', \Piwik\Version::VERSION) . '-';
}, 'Psr\\Log\\LoggerInterface' => DI\object('Psr\\Log\\NullLogger'), 'Piwik\\Translation\\Loader\\LoaderInterface' => DI\object('Piwik\\Translation\\Loader\\LoaderCache')->constructor(DI\get('Piwik\\Translation\\Loader\\JsonFileLoader')), 'observers.global' => array(), 'Piwik\\EventDispatcher' => DI\object()->constructorParameter('observers', DI\get('observers.global')));
示例3: array
use Piwik\SettingsServer;
return array('path.root' => PIWIK_USER_PATH, 'path.tmp' => function (ContainerInterface $c) {
$root = $c->get('path.root');
// TODO remove that special case and instead have plugins override 'path.tmp' to add the instance id
if ($c->has('ini.General.instance_id')) {
$instanceId = $c->get('ini.General.instance_id');
$instanceId = $instanceId ? '/' . $instanceId : '';
} else {
$instanceId = '';
}
return $root . '/tmp' . $instanceId;
}, 'path.cache' => DI\string('{path.tmp}/cache/tracker/'), 'Piwik\\Cache\\Eager' => function (ContainerInterface $c) {
$backend = $c->get('Piwik\\Cache\\Backend');
$cacheId = $c->get('cache.eager.cache_id');
if (SettingsServer::isTrackerApiRequest()) {
$eventToPersist = 'Tracker.end';
$cacheId .= 'tracker';
} else {
$eventToPersist = 'Request.dispatch.end';
$cacheId .= 'ui';
}
$cache = new Eager($backend, $cacheId);
\Piwik\Piwik::addAction($eventToPersist, function () use($cache) {
$cache->persistCacheIfNeeded(43200);
});
return $cache;
}, 'Piwik\\Cache\\Backend' => function (ContainerInterface $c) {
return \Piwik\Cache::buildBackend($c->get('ini.Cache.backend'));
}, 'cache.eager.cache_id' => function () {
return 'eagercache-' . str_replace(array('.', '-'), '', \Piwik\Version::VERSION) . '-';
}, 'Psr\\Log\\LoggerInterface' => DI\object('Psr\\Log\\NullLogger'), 'Piwik\\Translation\\Loader\\LoaderInterface' => DI\object('Piwik\\Translation\\Loader\\LoaderCache')->constructor(DI\get('Piwik\\Translation\\Loader\\JsonFileLoader')));