當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Cache::clearAll方法代碼示例

本文整理匯總了PHP中Cake\Cache\Cache::clearAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Cache::clearAll方法的具體用法?PHP Cache::clearAll怎麽用?PHP Cache::clearAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Cake\Cache\Cache的用法示例。


在下文中一共展示了Cache::clearAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: clearCache

 /**
  * Clears the caches
  *
  * @return void
  */
 public function clearCache()
 {
     if ($this->request->is('POST')) {
         \Cake\Cache\Cache::clearAll();
         $this->Flash->success(__d('elabs', 'The cache has been cleared'));
         $this->redirect($this->request->referer());
     } else {
         throw new \Cake\Network\Exception\MethodNotAllowedException(__d('elabs', 'Use the menu to access this functionality'));
     }
 }
開發者ID:el-cms,項目名稱:elabs,代碼行數:15,代碼來源:MaintenanceController.php

示例2: clearCache

 /**
  * Clears data of all configured Cache engines.
  *
  * @return void
  */
 public function clearCache()
 {
     Cache::clearAll();
     $this->out('All caches cleared');
 }
開發者ID:codekanzlei,項目名稱:cake-cktools,代碼行數:10,代碼來源:CkToolsShell.php

示例3: restore

 /**
  * Restores a backup file
  * @param string $filename Backup filename
  * @return \Cake\Network\Response|null
  * @uses MysqlBackup\Utility\BackupImport::filename()
  * @uses MysqlBackup\Utility\BackupImport::import()
  */
 public function restore($filename)
 {
     $filename = Configure::read('MysqlBackup.target') . DS . urldecode($filename);
     $backup = new BackupImport();
     $backup->filename($filename);
     if ($backup->import()) {
         //Clears the cache
         Cache::clearAll();
         $this->Flash->success(__d('me_cms', 'The operation has been performed correctly'));
     } else {
         $this->Flash->error(__d('me_cms', 'The operation has not been performed correctly'));
     }
     return $this->redirect(['action' => 'index']);
 }
開發者ID:mirko-pagliai,項目名稱:me-cms,代碼行數:21,代碼來源:BackupsController.php

示例4: clearCache

 /**
  * Internal function to clear the cache
  * @return bool
  */
 protected function clearCache()
 {
     return !array_search(false, Cache::clearAll(), true);
 }
開發者ID:mirko-pagliai,項目名稱:me-cms,代碼行數:8,代碼來源:SystemsController.php

示例5: testClearAll

 /**
  * test clearAll() method
  *
  * @return void
  */
 public function testClearAll()
 {
     Cache::config('configTest', ['engine' => 'File', 'path' => TMP . 'tests']);
     Cache::config('anotherConfigTest', ['engine' => 'File', 'path' => TMP . 'tests']);
     Cache::write('key_1', 'hello', 'configTest');
     Cache::write('key_2', 'hello again', 'anotherConfigTest');
     $this->assertSame(Cache::read('key_1', 'configTest'), 'hello');
     $this->assertSame(Cache::read('key_2', 'anotherConfigTest'), 'hello again');
     $result = Cache::clearAll();
     $this->assertTrue($result['configTest']);
     $this->assertTrue($result['anotherConfigTest']);
     $this->assertFalse(Cache::read('key_1', 'configTest'));
     $this->assertFalse(Cache::read('key_2', 'anotherConfigTest'));
     Cache::drop('configTest');
     Cache::drop('anotherConfigTest');
 }
開發者ID:rashmi,項目名稱:newrepo,代碼行數:21,代碼來源:CacheTest.php


注:本文中的Cake\Cache\Cache::clearAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。