当前位置: 首页>>代码示例>>PHP>>正文


PHP Cache::delete方法代码示例

本文整理汇总了PHP中Cake\Cache\Cache::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Cache::delete方法的具体用法?PHP Cache::delete怎么用?PHP Cache::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Cake\Cache\Cache的用法示例。


在下文中一共展示了Cache::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testNonFatalErrorsWithCacheDisable

 /**
  * Check that no fatal errors are issued doing normal things when Cache.disable is true.
  *
  * @return void
  */
 public function testNonFatalErrorsWithCacheDisable()
 {
     Cache::disable();
     $this->_configCache();
     $this->assertNull(Cache::write('no_save', 'Noooo!', 'tests'));
     $this->assertFalse(Cache::read('no_save', 'tests'));
     $this->assertNull(Cache::delete('no_save', 'tests'));
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:13,代码来源:CacheTest.php

示例2: testNonFatalErrorsWithCachedisable

 /**
  * Check that no fatal errors are issued doing normal things when Cache.disable is true.
  *
  * @return void
  */
 public function testNonFatalErrorsWithCachedisable()
 {
     Cache::disable();
     $this->_configCache();
     Cache::write('no_save', 'Noooo!', 'tests');
     Cache::read('no_save', 'tests');
     Cache::delete('no_save', 'tests');
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:13,代码来源:CacheTest.php

示例3: setUp

 /**
  * setup
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     TableRegistry::clear();
     $this->Articles = TableRegistry::get('Articles');
     Cache::config('default', ['className' => 'File', 'path' => CACHE, 'duration' => '+10 days']);
     Cache::delete('Related.attachedTables');
     Cache::delete('Related.indexedTables');
 }
开发者ID:aiphee,项目名称:cakephp-related-content,代码行数:14,代码来源:TestBehaviorsTest.php

示例4: testDescribeCache

 /**
  * Tests that schema metadata is cached
  *
  * @return void
  */
 public function testDescribeCache()
 {
     $schema = $this->connection->schemaCollection();
     $table = $this->connection->schemaCollection()->describe('users');
     Cache::delete('test_users', '_cake_model_');
     $schema->cacheMetadata(true);
     $result = $schema->describe('users');
     $this->assertEquals($table, $result);
     $result = Cache::read('test_users', '_cake_model_');
     $this->assertEquals($table, $result);
 }
开发者ID:ripzappa0924,项目名称:carte0.0.1,代码行数:16,代码来源:CollectionTest.php

示例5: testDescribeCache

 /**
  * Tests that schema metadata is cached
  *
  * @return void
  */
 public function testDescribeCache()
 {
     $schema = $this->connection->methodSchemaCollection();
     $method = $this->connection->methodSchemaCollection()->describe('CALC.SUM');
     Cache::delete('test_CALC_SUM', '_cake_method_');
     $this->connection->cacheMetadata(true);
     $schema = $this->connection->methodSchemaCollection();
     $result = $schema->describe('CALC.SUM');
     $this->assertEquals($method, $result);
     $result = Cache::read('test_CALC_SUM', '_cake_method_');
     $this->assertEquals($method, $result);
 }
开发者ID:cakedc,项目名称:cakephp-oracle-driver,代码行数:17,代码来源:CollectionTest.php

示例6: load

 /**
  * Loads a plugin and optionally loads bootstrapping and routing files.
  *
  * This method is identical to CakePlugin::load() with extra functionality
  * that loads event configuration when Plugin/Config/events.php is present.
  *
  * @see CakePlugin::load()
  * @param mixed $plugin name of plugin, or array of plugin and its config
  * @return void
  */
 public static function load($plugin, $config = [])
 {
     Plugin::load($plugin, $config);
     if (is_string($plugin)) {
         $plugin = [$plugin => $config];
     }
     Cache::delete('EventHandlers', 'default');
     foreach ($plugin as $name => $conf) {
         list($name, $conf) = is_numeric($name) ? [$conf, $config] : [$name, $conf];
         Hook::applyHookConfigFiles('Hook.config_files', $name);
     }
 }
开发者ID:mohammadsaleh,项目名称:spider,代码行数:22,代码来源:SpiderPlugin.php

示例7: clear

 protected function clear($alias, array $params = [])
 {
     $params += ['config' => true, 'cache' => true];
     if (true === $params['config']) {
         $key = $this->Items->behaviors()->get($alias)->cacheKey();
         Cache::delete($key);
     }
     if (true === $params['cache']) {
         $behavior = $this->Items->behaviors()->get($alias);
         $key = ConfigureKey::fqn($behavior);
         Configure::write($key, null);
     }
 }
开发者ID:jmjjg,项目名称:cakephp-database,代码行数:13,代码来源:AutovalidateBehaviorTest.php

示例8: testGetTypes

 /**
  * Tests the getTypes method
  *
  * @return void
  * @covers ::getTypes
  */
 public function testGetTypes()
 {
     Cache::delete('database_log_types');
     $this->Logs->deleteAll('1=1');
     $data = ['type' => 'Foo', 'message' => 'some text'];
     $log = $this->Logs->newEntity($data);
     $res = $this->Logs->save($log);
     $this->assertTrue(!empty($res));
     $data = ['type' => 'Bar', 'message' => 'some more text'];
     $log = $this->Logs->newEntity($data);
     $res = $this->Logs->save($log);
     $this->assertTrue(!empty($res));
     $res = $this->Logs->getTypes();
     $this->assertSame(['Bar', 'Foo'], $res);
 }
开发者ID:dereuromark,项目名称:cakephp-databaselog,代码行数:21,代码来源:LogsTableTest.php

示例9: beforeLayout

 /**
  * Callback for Helper::beforeLayout
  *
  * @param Event $view Event
  * @param string $layoutFile layout file name
  *
  * @return bool true
  */
 public function beforeLayout(Event $event, $layoutFile)
 {
     if (!Cache::enabled()) {
         $this->config('disable', true);
     } elseif (!$this->request->is('get')) {
         $this->config('disable', true);
     } elseif ($this->request->session()->check('Flash')) {
         $this->config('disable', true);
     } elseif ($this->_View->get(ViewMemcachedHelper::NOCACHE)) {
         $this->config('disable', true);
     }
     if ($this->_View->get(ViewMemcachedHelper::DELETE) === true) {
         Cache::delete($this->config('cacheKey'), $this->config('cacheConfig'));
     }
     return true;
 }
开发者ID:chnvcode,项目名称:cakephp-viewmemcached,代码行数:24,代码来源:ViewMemcachedHelper.php

示例10: edit

 /**
  * Edit a setting.
  *
  * @return \Cake\Network\Response|void
  */
 public function edit()
 {
     $setting = $this->Settings->find()->where(['Settings.id' => $this->request->id])->first();
     if (is_null($setting)) {
         $this->Flash->error(__d('admin', 'This setting doesn\'t exist or has been deleted.'));
         return $this->redirect(['action' => 'index']);
     }
     if ($this->request->is(['post', 'put'])) {
         $this->Settings->patchEntity($setting, $this->request->data);
         $setting->last_updated_user_id = $this->Auth->user('id');
         if ($this->Settings->save($setting)) {
             Cache::delete('settings', 'database');
             $this->Flash->success(__d('admin', 'This setting has been edited successfully !'));
             return $this->redirect(['action' => 'index']);
         }
     }
     $this->set(compact('setting'));
 }
开发者ID:Xety,项目名称:Xeta,代码行数:23,代码来源:SettingsController.php

示例11: clear

 /**
  * Clear metadata.
  *
  * @param string|null $name The name of the table to clear cache data for.
  * @return bool
  */
 public function clear($name = null)
 {
     $schema = $this->_getSchema();
     if (!$schema) {
         return false;
     }
     $tables = [$name];
     if (empty($name)) {
         $tables = $schema->listTables();
     }
     $configName = $schema->cacheMetadata();
     foreach ($tables as $table) {
         $this->_io->verbose(sprintf('Clearing metadata cache from "%s" for %s', $configName, $table));
         $key = $schema->cacheKey($table);
         Cache::delete($key, $configName);
     }
     $this->out('<success>Cache clear complete</success>');
     return true;
 }
开发者ID:CakeDC,项目名称:cakephp,代码行数:25,代码来源:OrmCacheShell.php

示例12: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $schema = $this->_getSchema($input, $output);
     $name = $input->getArgument('name');
     if (!$schema) {
         return false;
     }
     $tables = [$name];
     if (empty($name)) {
         $tables = $schema->listTables();
     }
     $configName = $schema->cacheMetadata();
     foreach ($tables as $table) {
         $output->writeln(sprintf('Clearing metadata cache from "%s" for %s', $configName, $table));
         $key = $schema->cacheKey($table);
         Cache::delete($key, $configName);
     }
     $output->writeln('<info>Cache clear complete<info>');
     return true;
 }
开发者ID:harikt,项目名称:cakephp-orm-shell,代码行数:20,代码来源:ORMCacheClear.php

示例13: testAdd

 /**
  * Test add
  *
  * @return void
  */
 public function testAdd()
 {
     Cache::delete('test_add_key', 'memcached');
     $result = Cache::add('test_add_key', 'test data', 'memcached');
     $this->assertTrue($result);
     $expected = 'test data';
     $result = Cache::read('test_add_key', 'memcached');
     $this->assertEquals($expected, $result);
     $result = Cache::add('test_add_key', 'test data 2', 'memcached');
     $this->assertFalse($result);
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:16,代码来源:MemcachedEngineTest.php

示例14: doDelete

 /**
  * {@inheritDoc}
  */
 protected function doDelete($id)
 {
     return Cache::delete($id, $this->config);
 }
开发者ID:lorenzo,项目名称:piping-bag,代码行数:7,代码来源:CacheAdapter.php

示例15: testViewVarNocache

 /**
  * testViewVarNocache method
  *
  * @return void
  */
 public function testViewVarNocache()
 {
     $this->helper->config('gzipCompress', false);
     $cacheConfig = $this->helper->config('cacheConfig');
     $cacheKey = $this->helper->config('cacheKey');
     Cache::delete($cacheKey, $cacheConfig);
     $this->View->set(ViewMemcachedHelper::NOCACHE, true);
     $this->View->set('test', 'nocache');
     $content = $this->View->render('home', 'default');
     $cache = Cache::read($cacheKey, $cacheConfig);
     $this->assertTrue($cache === false);
 }
开发者ID:chnvcode,项目名称:cakephp-viewmemcached,代码行数:17,代码来源:ViewMemcachedHelperTest.php


注:本文中的Cake\Cache\Cache::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。