当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::configured方法代码示例

本文整理汇总了PHP中Cake\Cache\Cache::configured方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::configured方法的具体用法?PHP Cache::configured怎么用?PHP Cache::configured使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Cache\Cache的用法示例。


在下文中一共展示了Cache::configured方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: listPrefixes

 /**
  * Show a list of all defined cache prefixes.
  *
  * @return void
  */
 public function listPrefixes()
 {
     $prefixes = Cache::configured();
     foreach ($prefixes as $prefix) {
         $this->out($prefix);
     }
 }
开发者ID:nrother,项目名称:cakephp,代码行数:12,代码来源:CacheShell.php

示例2: __construct

 /**
  * TinyAuthorize::__construct()
  *
  * @param \Cake\Controller\ComponentRegistry $registry
  * @param array $config
  * @throws \Cake\Core\Exception\Exception
  */
 public function __construct(ComponentRegistry $registry, array $config = [])
 {
     $config += (array) Configure::read('TinyAuth');
     $config += $this->_defaultConfig;
     if (!$config['prefixes'] && !empty($config['authorizeByPrefix'])) {
         throw new Exception('Invalid TinyAuthorization setup for `authorizeByPrefix`. Please declare `prefixes`.');
     }
     parent::__construct($registry, $config);
     if (!in_array($config['cache'], Cache::configured())) {
         throw new Exception(sprintf('Invalid TinyAuthorization cache `%s`', $config['cache']));
     }
 }
开发者ID:bravo-kernel,项目名称:cakephp-tinyauth,代码行数:19,代码来源:TinyAuthorize.php

示例3: initialize

 /**
  * Initialize - install cache spies.
  *
  * @return void
  */
 public function initialize()
 {
     foreach (Cache::configured() as $name) {
         $config = Cache::config($name);
         if ($config['className'] instanceof DebugEngine) {
             $instance = $config['className'];
         } else {
             Cache::drop($name);
             $instance = new DebugEngine($config);
             Cache::config($name, $instance);
         }
         $this->_instances[$name] = $instance;
     }
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:19,代码来源:CachePanel.php

示例4: _prepareConfig

 /**
  * @param array $config
  * @throws \Cake\Core\Exception\Exception
  * @return array
  */
 protected function _prepareConfig(array $config)
 {
     $config += $this->_defaultConfig();
     if (!$config['prefixes'] && !empty($config['authorizeByPrefix'])) {
         throw new Exception('Invalid TinyAuthorization setup for `authorizeByPrefix`. Please declare `prefixes`.');
     }
     if (!in_array($config['cache'], Cache::configured())) {
         throw new Exception(sprintf('Invalid TinyAuth cache `%s`', $config['cache']));
     }
     if ($config['autoClearCache'] === null) {
         $config['autoClearCache'] = Configure::read('debug');
     }
     return $config;
 }
开发者ID:dereuromark,项目名称:cakephp-tinyauth,代码行数:19,代码来源:AclTrait.php

示例5: testConfigured

 /**
  * test that configured returns an array of the currently configured cache
  * config
  *
  * @return void
  */
 public function testConfigured()
 {
     Cache::drop('default');
     $result = Cache::configured();
     $this->assertContains('_cake_core_', $result);
     $this->assertNotContains('default', $result, 'Unconnected engines should not display.');
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:13,代码来源:CacheTest.php

示例6: cache

 /**
  * Get/Set caching.
  *
  * @param null|bool|string $cache Cache config name to use, If true is passed, 'cake_pdf' will be used.
  * @throws \Cake\Core\Exception\Exception
  * @return mixed
  */
 public function cache($cache = null)
 {
     if ($cache === null) {
         return $this->_cache;
     }
     if ($cache === false) {
         $this->_cache = false;
         return $this;
     }
     if ($cache === true) {
         $cache = 'cake_pdf';
     }
     if (!in_array($cache, Cache::configured())) {
         throw new Exception(sprintf('CakePdf cache is not configured: %s', $cache));
     }
     $this->_cache = $cache;
     return $this;
 }
开发者ID:Iteracode,项目名称:CakePdf,代码行数:25,代码来源:CakePdf.php

示例7: function

use Cake\Datasource\ConnectionManager;
$findRoot = function ($root) {
    do {
        $lastRoot = $root;
        $root = dirname($root);
        if (is_dir($root . '/vendor/cakephp/cakephp')) {
            return $root;
        }
    } while ($root !== $lastRoot);
    throw new Exception('Cannot find the root of the application, unable to run tests');
};
$root = $findRoot(__FILE__);
unset($findRoot);
chdir($root);
require_once 'vendor/cakephp/cakephp/src/basics.php';
require_once 'vendor/autoload.php';
define('ROOT', $root . DS . 'tests' . DS . 'test_app' . DS);
define('APP', ROOT . 'TestApp' . DS);
define('TMP', sys_get_temp_dir() . DS);
Configure::write('debug', true);
Configure::write('App', ['namespace' => 'TestApp', 'paths' => ['plugins' => [ROOT . 'Plugin' . DS]]]);
if (!getenv('db_dsn')) {
    putenv('db_dsn=sqlite:///:memory:');
}
ConnectionManager::config('test', ['url' => getenv('db_dsn')]);
// Wipe out any accumulated caches before running tests.
foreach (\Cake\Cache\Cache::configured() as $key) {
    \Cake\Cache\Cache::clear(false, $key);
    echo "Cleared cache: {$key}\n";
}
echo PHP_EOL;
开发者ID:loadsys,项目名称:cakephp-libregistry,代码行数:31,代码来源:bootstrap.php


注:本文中的Cake\Cache\Cache::configured方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。