本文整理汇总了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'));
}
}
示例2: clearCache
/**
* Clears data of all configured Cache engines.
*
* @return void
*/
public function clearCache()
{
Cache::clearAll();
$this->out('All caches cleared');
}
示例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']);
}
示例4: clearCache
/**
* Internal function to clear the cache
* @return bool
*/
protected function clearCache()
{
return !array_search(false, Cache::clearAll(), true);
}
示例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');
}