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


PHP Cache::clear方法代码示例

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


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

示例1: tearDown

 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Cache::clear(false, 'session_test');
     Cache::drop('session_test');
     unset($this->storage);
 }
开发者ID:Slayug,项目名称:castor,代码行数:12,代码来源:CacheSessionTest.php

示例2: setUp

 /**
  * Setup function
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->connection = ConnectionManager::get('test');
     Cache::clear(false, '_cake_method_');
     Cache::enable();
 }
开发者ID:cakedc,项目名称:cakephp-oracle-driver,代码行数:12,代码来源:CollectionTest.php

示例3: testTranslationCaching

 /**
  * testTranslationCaching method
  *
  * @return void
  */
 public function testTranslationCaching()
 {
     $this->skipIf(!Cache::engine('_cake_core_'), 'Missing _cake_core_ cache config, cannot test caching.');
     Configure::write('Config.language', 'cache_test_po');
     // reset internally stored entries
     I18n::clear();
     Cache::clear(false, '_cake_core_');
     $lang = Configure::read('Config.language');
     // make some calls to translate using different domains
     $this->assertEquals('Dom 1 Foo', I18n::translate('dom1.foo', false, 'dom1'));
     $this->assertEquals('Dom 1 Bar', I18n::translate('dom1.bar', false, 'dom1'));
     $domains = I18n::domains();
     $this->assertEquals('Dom 1 Foo', $domains['dom1']['cache_test_po']['LC_MESSAGES']['dom1.foo']);
     // reset internally stored entries
     I18n::clear();
     // now only dom1 should be in cache
     $cachedDom1 = Cache::read('dom1_' . $lang, '_cake_core_');
     $this->assertEquals('Dom 1 Foo', $cachedDom1['LC_MESSAGES']['dom1.foo']);
     $this->assertEquals('Dom 1 Bar', $cachedDom1['LC_MESSAGES']['dom1.bar']);
     // dom2 not in cache
     $this->assertFalse(Cache::read('dom2_' . $lang, '_cake_core_'));
     // translate a item of dom2 (adds dom2 to cache)
     $this->assertEquals('Dom 2 Foo', I18n::translate('dom2.foo', false, 'dom2'));
     // verify dom2 was cached through manual read from cache
     $cachedDom2 = Cache::read('dom2_' . $lang, '_cake_core_');
     $this->assertEquals('Dom 2 Foo', $cachedDom2['LC_MESSAGES']['dom2.foo']);
     $this->assertEquals('Dom 2 Bar', $cachedDom2['LC_MESSAGES']['dom2.bar']);
     // modify cache entry manually to verify that dom1 entries now will be read from cache
     $cachedDom1['LC_MESSAGES']['dom1.foo'] = 'FOO';
     Cache::write('dom1_' . $lang, $cachedDom1, '_cake_core_');
     $this->assertEquals('FOO', I18n::translate('dom1.foo', false, 'dom1'));
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:37,代码来源:I18nTest.php

示例4: main

 /**
  * Execute the ClearCache task.
  *
  * @return void
  */
 public function main()
 {
     Cache::clear(false, '_cake_core_');
     Cache::clear(false, 'database');
     Cache::clear(false, 'acl');
     $this->out('<info>The</info> "<error>deployer clear_cache</error>" <info>command has been executed successfully !</info>', 2);
 }
开发者ID:Xety,项目名称:Xeta,代码行数:12,代码来源:ClearCacheTask.php

示例5: setUp

 /**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Cache::clear(false);
     $this->apiFolderName = 'NonExistingApiPrefixedFolder';
     $this->apiFolderPath = APP . 'Controller' . DS . $this->apiFolderName;
 }
开发者ID:alt3,项目名称:cakephp-app-configurator,代码行数:12,代码来源:PlusPlusTest.php

示例6: cleanup

 /**
  * Clears the cache
  *
  * @return void
  */
 public function cleanup()
 {
     Cache::clear(false, 'default');
     Cache::clear(false, '_cake_model_');
     Cache::clear(false, '_cake_core_');
     $this->dispatchShell('orm_cache clear');
     $this->dispatchShell('orm_cache build');
 }
开发者ID:gintonicweb,项目名称:gintonic-cms,代码行数:13,代码来源:GintonicShell.php

示例7: main

 public function main()
 {
     if (Cache::clear(false)) {
         $this->success('Cake cache clear complete');
     } else {
         $this->err("Error : Cake cache clear failed");
     }
 }
开发者ID:daoandco,项目名称:cakephp-cachecleaner,代码行数:8,代码来源:CakeTask.php

示例8: tearDown

 /**
  * Tear down method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     I18n::clear();
     I18n::defaultFormatter('default');
     I18n::locale($this->locale);
     Plugin::unload();
     Cache::clear(false, '_cake_core_');
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:14,代码来源:I18nTest.php

示例9: clearCache

 /**
  * Clear a named cache.
  *
  * @return void
  * @throws \Cake\Network\Exception\NotFoundException
  */
 public function clearCache()
 {
     $this->request->allowMethod('post');
     if (!$this->request->data('name')) {
         throw new NotFoundException('Invalid cache engine name.');
     }
     $result = Cache::clear(false, $this->request->data('name'));
     $this->set(['_serialize' => ['success'], 'success' => $result]);
 }
开发者ID:fabioalvaro,项目名称:cakexuxu,代码行数:15,代码来源:ToolbarController.php

示例10: index

 public function index()
 {
     //Just a way to trigger committed migrations from web interface
     echo "<pre>";
     passthru('php ../bin/cake.php migrations migrate -vvv');
     echo "</pre>";
     //Clear the Model cache so any db updates will re-load
     \Cake\Cache\Cache::clear(false, '_cake_model_');
     exit;
 }
开发者ID:byu-oit-appdev,项目名称:byusa-clubs,代码行数:10,代码来源:MigrateController.php

示例11: down

 /**
  * Migrate down
  */
 public function down()
 {
     $table = $this->table('menus');
     $table->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('menu_item_count', 'integer', ['default' => 0, 'null' => false])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
     $table->addIndex('name', ['name' => 'BY_NAME', 'unique' => false]);
     $table->create();
     $id = new Column();
     $id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
     $table->changeColumn('id', $id)->save();
     Cache::clear();
 }
开发者ID:wasabi-cms,项目名称:core,代码行数:14,代码来源:20160526075322_remove_menus.php

示例12: testPermissionLevelAndAjax

 /**
  * Test permission with setup level and ajax request.
  *
  * @return void
  */
 public function testPermissionLevelAndAjax()
 {
     $url = array_replace($this->url, ['action' => 'permissions', 2, 0]);
     $this->_request['environment']['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
     Cache::clear('permissions_aco_2', 'permissions');
     $this->get($url);
     $viewVars = $this->_controller->viewVars;
     $this->assertResponseOk();
     $this->assertInstanceOf('JBZoo\\Data\\Data', $viewVars['permissions'][3]);
     $this->assertSame('display', $viewVars['permissions'][3]->get('alias'));
     $this->assertSame(1, count($viewVars['acos']));
 }
开发者ID:UnionCMS,项目名称:Community,代码行数:17,代码来源:AclControllerTest.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     if ($this->isDebug()) {
         $this->GeoImport = new GeoImportLib();
         return;
     }
     $this->GeoImport = $this->getMock('Data\\Lib\\GeoImportLib', ['_getFromUrl']);
     $this->path = Plugin::path('Data') . 'tests' . DS . 'test_files' . DS . 'html' . DS;
     // Liste-der-St-C3-A4dte-in-der-Schweiz-action-edit-section-4.html
     Cache::clear();
 }
开发者ID:dereuromark,项目名称:cakephp-data,代码行数:12,代码来源:GeoImportLibTest.php

示例14: down

 /**
  * Migrate down
  */
 public function down()
 {
     $table = $this->table('menu_items');
     $table->addColumn('menu_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('parent_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => true, 'default' => null])->addColumn('lft', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('rght', 'integer', ['limit' => 11, 'signed' => false, 'null' => false])->addColumn('name', 'string', ['limit' => 255, 'null' => false])->addColumn('type', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('target', 'text', ['null' => true, 'default' => null])->addColumn('external_link', 'text', ['null' => true, 'default' => null])->addColumn('foreign_model', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('foreign_id', 'integer', ['limit' => 11, 'signed' => false, 'null' => true, 'default' => null])->addColumn('plugin', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('controller', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('action', 'string', ['limit' => 255, 'null' => true, 'default' => null])->addColumn('params', 'text', ['null' => true, 'default' => null])->addColumn('query', 'text', ['null' => true, 'default' => null])->addColumn('created', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP'])->addColumn('modified', 'datetime', ['null' => false, 'default' => 'CURRENT_TIMESTAMP']);
     $table->addIndex('menu_id', ['name' => 'FK_MENU_ID', 'unique' => false]);
     $table->addIndex('parent_id', ['name' => 'FK_PARENT_ID', 'unique' => false]);
     $table->create();
     $id = new Column();
     $id->setIdentity(true)->setType('integer')->setOptions(['limit' => 11, 'signed' => false, 'null' => false]);
     $table->changeColumn('id', $id)->save();
     Cache::clear();
 }
开发者ID:wasabi-cms,项目名称:core,代码行数:15,代码来源:20160526075335_remove_menu_items.php

示例15: find

 /**
  * Creates a new Query for this repository and applies some defaults based
  *  on the type of search that was selected
  * @param string $type The type of query to perform
  * @param array|ArrayAccess $options An array that will be passed to
  *  Query::applyOptions()
  * @return Cake\ORM\Query The query builder
  * @uses setNextToBePublished()
  * @uses $cache
  */
 public function find($type = 'all', $options = [])
 {
     //Gets from cache the timestamp of the next record to be published
     $next = Cache::read('next_to_be_published', $this->cache);
     //If the cache is not valid, it empties the cache
     if ($next && time() >= $next) {
         Cache::clear(false, $this->cache);
         //Sets the next record to be published
         $this->setNextToBePublished();
     }
     return parent::find($type, $options);
 }
开发者ID:mirko-pagliai,项目名称:me-cms,代码行数:22,代码来源:PagesTable.php


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