本文整理汇总了PHP中Cake\Cache\Cache::drop方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::drop方法的具体用法?PHP Cache::drop怎么用?PHP Cache::drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Cache\Cache
的用法示例。
在下文中一共展示了Cache::drop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tearDown
/**
* Teardown
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Cache::drop('orm_cache');
$ds = ConnectionManager::get('test');
$ds->cacheMetadata(false);
}
示例2: tearDown
/**
* tearDown
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Cache::clear(false, 'session_test');
Cache::drop('session_test');
unset($this->storage);
}
示例3: tearDown
/**
* Tear down data.
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
Plugin::unload($this->plugin);
Cache::drop('permissions');
Cache::drop('permission_roles');
unset($this->Roles, $this->Users, $this->userData);
}
示例4: tearDown
/**
* Tear down.
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->_controller, $this->url, $this->data);
Plugin::unload($this->plugin);
Plugin::unload('Union/Extensions');
Cache::drop('permissions');
Cache::drop('permission_roles');
Cache::drop('plugins');
}
示例5: beforeFilter
/**
* Called before the controller action. You can use this method to configure and customize components
* or perform logic that needs to happen before each controller action.
*
* @param Event $event An Event instance
* @return void
* @link http://book.cakephp.org/3.0/en/controllers.html#request-life-cycle-callbacks
*/
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
// TODO: Change the autogenerated stub
if ($this->request->data) {
Cache::drop('settingsFrontend');
Cache::drop('menuParents');
Cache::drop('subMenu');
}
}
示例6: __construct
/**
* CacheStorage constructor.
* @param array $config initial configuration
*/
public function __construct(array $config)
{
$this->config($config);
$_config = $this->config();
$_configName = $_config['cacheConfig'];
unset($_config['cacheConfig']);
if (Cache::config($_configName)) {
Cache::drop($_configName);
}
Cache::config($_configName, $_config);
}
示例7: initialize
/**
* Initialize - install cache spies.
*
* @return void
*/
public function initialize()
{
foreach (Cache::configured() as $name) {
$config = Cache::config($name);
if ($config['className'] instanceof DebugEngine) {
$instance = $config['className'];
} else {
Cache::drop($name);
$instance = new DebugEngine($config);
Cache::config($name, $instance);
}
$this->_instances[$name] = $instance;
}
}
示例8: testStoreAndRestoreWithData
/**
* test that store and restore only store/restore the provided data.
*
* @return void
*/
public function testStoreAndRestoreWithData()
{
Cache::enable();
Cache::config('configure', ['className' => 'File', 'path' => TMP . 'tests']);
Configure::write('testing', 'value');
Configure::store('store_test', 'configure', ['store_test' => 'one']);
Configure::delete('testing');
$this->assertNull(Configure::read('store_test'), 'Calling store with data shouldn\'t modify runtime.');
Configure::restore('store_test', 'configure');
$this->assertEquals('one', Configure::read('store_test'));
$this->assertNull(Configure::read('testing'), 'Values that were not stored are not restored.');
Cache::delete('store_test', 'configure');
Cache::drop('configure');
}
示例9: testClearingWithRepeatWrites
/**
* Test that clearing with repeat writes works properly
*
* @return void
*/
public function testClearingWithRepeatWrites()
{
Cache::config('repeat', ['engine' => 'File', 'groups' => ['users']]);
$this->assertTrue(Cache::write('user', 'rchavik', 'repeat'));
$this->assertEquals('rchavik', Cache::read('user', 'repeat'));
Cache::delete('user', 'repeat');
$this->assertEquals(false, Cache::read('user', 'repeat'));
$this->assertTrue(Cache::write('user', 'ADmad', 'repeat'));
$this->assertEquals('ADmad', Cache::read('user', 'repeat'));
Cache::clearGroup('users', 'repeat');
$this->assertEquals(false, Cache::read('user', 'repeat'));
$this->assertTrue(Cache::write('user', 'markstory', 'repeat'));
$this->assertEquals('markstory', Cache::read('user', 'repeat'));
Cache::drop('repeat');
}
示例10: testElementCache
/**
* Test elementCache method
*
* @return void
*/
public function testElementCache()
{
Cache::drop('test_view');
Cache::config('test_view', ['engine' => 'File', 'duration' => '+1 day', 'path' => CACHE . 'views/', 'prefix' => '']);
Cache::clear(false, 'test_view');
$View = $this->PostsController->createView();
$View->elementCache = 'test_view';
$result = $View->element('test_element', [], ['cache' => true]);
$expected = 'this is the test element';
$this->assertEquals($expected, $result);
$result = Cache::read('element__test_element_cache_callbacks', 'test_view');
$this->assertEquals($expected, $result);
$result = $View->element('test_element', ['param' => 'one', 'foo' => 'two'], ['cache' => true]);
$this->assertEquals($expected, $result);
$result = Cache::read('element__test_element_cache_callbacks_param_foo', 'test_view');
$this->assertEquals($expected, $result);
$View->element('test_element', ['param' => 'one', 'foo' => 'two'], ['cache' => ['key' => 'custom_key']]);
$result = Cache::read('element_custom_key', 'test_view');
$this->assertEquals($expected, $result);
$View->elementCache = 'default';
$View->element('test_element', ['param' => 'one', 'foo' => 'two'], ['cache' => ['config' => 'test_view']]);
$result = Cache::read('element__test_element_cache_callbacks_param_foo', 'test_view');
$this->assertEquals($expected, $result);
Cache::clear(true, 'test_view');
Cache::drop('test_view');
}
示例11: tearDown
/**
* tearDown method
*
* @return void
*/
public function tearDown()
{
parent::tearDown();
unset($this->Acl);
Cache::clear(false, 'tests');
Cache::drop('tests');
}
示例12: testMultiDatabaseOperations
/**
* testMultiDatabaseOperations method
*
* @return void
*/
public function testMultiDatabaseOperations()
{
Cache::config('redisdb0', array('engine' => 'Redis', 'prefix' => 'cake2_', 'duration' => 3600, 'persistent' => false));
Cache::config('redisdb1', array('engine' => 'Redis', 'database' => 1, 'prefix' => 'cake2_', 'duration' => 3600, 'persistent' => false));
$result = Cache::write('save_in_0', true, 'redisdb0');
$exist = Cache::read('save_in_0', 'redisdb0');
$this->assertTrue($result);
$this->assertTrue($exist);
$result = Cache::write('save_in_1', true, 'redisdb1');
$this->assertTrue($result);
$exist = Cache::read('save_in_0', 'redisdb1');
$this->assertFalse($exist);
$exist = Cache::read('save_in_1', 'redisdb1');
$this->assertTrue($exist);
Cache::delete('save_in_0', 'redisdb0');
$exist = Cache::read('save_in_0', 'redisdb0');
$this->assertFalse($exist);
Cache::delete('save_in_1', 'redisdb1');
$exist = Cache::read('save_in_1', 'redisdb1');
$this->assertFalse($exist);
Cache::drop('redisdb0');
Cache::drop('redisdb1');
}
示例13: _createCacheConfig
/**
* Create the cache config for this component
*
* @return void
*/
protected function _createCacheConfig()
{
if ($this->_isCacheEnabled()) {
$cache = array('duration' => $this->cacheDuration, 'engine' => 'File', 'path' => CACHE);
if (isset($this->settings['cache'])) {
$cache = array_merge($cache, $this->settings['cache']);
}
Cache::drop('SassComponent');
Cache::config('SassComponent', $cache);
}
}
示例14: testCachedRenderArrayConfig
/**
* Test cached render array config
*
* @return void
*/
public function testCachedRenderArrayConfig()
{
$mock = $this->getMock('Cake\\Cache\\CacheEngine');
$mock->method('init')->will($this->returnValue(true));
$mock->method('read')->will($this->returnValue(false));
$mock->expects($this->once())->method('write')->with('my_key', "dummy\n");
Cache::config('cell', $mock);
$cell = $this->View->cell('Articles', [], ['cache' => ['key' => 'my_key', 'config' => 'cell']]);
$result = $cell->render();
$this->assertEquals("dummy\n", $result);
Cache::drop('cell');
}
示例15: testWriteTriggerError
/**
* Test that failed writes cause errors to be triggered.
*
* @return void
*/
public function testWriteTriggerError()
{
Configure::write('App.namespace', 'TestApp');
Cache::config('test_trigger', ['engine' => 'TestAppCache', 'prefix' => '']);
try {
Cache::write('fail', 'value', 'test_trigger');
$this->fail('No exception thrown');
} catch (\PHPUnit_Framework_Error $e) {
$this->assertTrue(true);
}
Cache::drop('test_trigger');
}