當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。