コード例 #1
0
 /**
  * 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'));
     }
 }
コード例 #2
0
 /**
  * Clears data of all configured Cache engines.
  *
  * @return void
  */
 public function clearCache()
 {
     Cache::clearAll();
     $this->out('All caches cleared');
 }
コード例 #3
0
 /**
  * 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']);
 }
コード例 #4
0
 /**
  * Internal function to clear the cache
  * @return bool
  */
 protected function clearCache()
 {
     return !array_search(false, Cache::clearAll(), true);
 }
コード例 #5
0
ファイル: CacheTest.php プロジェクト: rashmi/newrepo
 /**
  * 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');
 }