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


PHP cache_helper::purge_by_definition方法代码示例

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


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

示例1: redirect

             redirect($PAGE->url);
         }
     }
     break;
 case 'purgedefinition':
     // Purge a specific definition.
     $definition = required_param('definition', PARAM_SAFEPATH);
     list($component, $area) = explode('/', $definition, 2);
     $factory = cache_factory::instance();
     $definition = $factory->create_definition($component, $area);
     if ($definition->has_required_identifiers()) {
         // We will have to purge the stores used by this definition.
         cache_helper::purge_stores_used_by_definition($component, $area);
     } else {
         // Alrighty we can purge just the data belonging to this definition.
         cache_helper::purge_by_definition($component, $area);
     }
     redirect($PAGE->url, get_string('purgedefinitionsuccess', 'cache'), 5);
     break;
 case 'purgestore':
 case 'purge':
     // Purge a store cache.
     $store = required_param('store', PARAM_TEXT);
     cache_helper::purge_store($store);
     redirect($PAGE->url, get_string('purgestoresuccess', 'cache'), 5);
     break;
 case 'newlockinstance':
     // Adds a new lock instance.
     $lock = required_param('lock', PARAM_ALPHANUMEXT);
     $mform = cache_administration_helper::get_add_lock_form($lock);
     if ($mform->is_cancelled()) {
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:admin.php

示例2: reset_caches

 /**
  * Resets the internal column details cache
  * @return void
  */
 public function reset_caches()
 {
     $this->tables = null;
     // Purge MUC as well
     $identifiers = array('dbfamily' => $this->get_dbfamily(), 'settings' => $this->get_settings_hash());
     cache_helper::purge_by_definition('core', 'databasemeta', $identifiers);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:11,代码来源:moodle_database.php

示例3: test_purge_routines

 /**
  * Test purge routines.
  */
 public function test_purge_routines()
 {
     $instance = cache_config_testing::instance(true);
     $instance->phpunit_add_definition('phpunit/purge1', array('mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', 'area' => 'purge1'));
     $instance->phpunit_add_definition('phpunit/purge2', array('mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', 'area' => 'purge2', 'requireidentifiers' => array('id')));
     $factory = cache_factory::instance();
     $definition = $factory->create_definition('phpunit', 'purge1');
     $this->assertFalse($definition->has_required_identifiers());
     $cache = $factory->create_cache($definition);
     $this->assertInstanceOf('cache_application', $cache);
     $this->assertTrue($cache->set('test', 'test'));
     $this->assertTrue($cache->has('test'));
     cache_helper::purge_by_definition('phpunit', 'purge1');
     $this->assertFalse($cache->has('test'));
     $factory = cache_factory::instance();
     $definition = $factory->create_definition('phpunit', 'purge2');
     $this->assertTrue($definition->has_required_identifiers());
     $cache = $factory->create_cache($definition);
     $this->assertInstanceOf('cache_application', $cache);
     $this->assertTrue($cache->set('test', 'test'));
     $this->assertTrue($cache->has('test'));
     cache_helper::purge_stores_used_by_definition('phpunit', 'purge2');
     $this->assertFalse($cache->has('test'));
     try {
         cache_helper::purge_by_definition('phpunit', 'purge2');
         $this->fail('Should not be able to purge a definition required identifiers without providing them.');
     } catch (coding_exception $ex) {
         $this->assertContains('Identifier required for cache has not been provided', $ex->getMessage());
     }
 }
开发者ID:barrysspace,项目名称:moodle,代码行数:33,代码来源:cache_test.php

示例4: test_application_definition_purge

 /**
  * Tests application cache definition purge
  */
 public function test_application_definition_purge()
 {
     $instance = cache_config_phpunittest::instance();
     $instance->phpunit_add_definition('phpunit/definitionpurgetest', array('mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', 'area' => 'definitionpurgetest', 'invalidationevents' => array('crazyevent')));
     $cache = cache::make('phpunit', 'definitionpurgetest');
     $this->assertTrue($cache->set('testkey1', 'test data 1'));
     $this->assertEquals('test data 1', $cache->get('testkey1'));
     $this->assertTrue($cache->set('testkey2', 'test data 2'));
     $this->assertEquals('test data 2', $cache->get('testkey2'));
     // Purge the event.
     cache_helper::purge_by_definition('phpunit', 'definitionpurgetest');
     // Check things have been removed.
     $this->assertFalse($cache->get('testkey1'));
     $this->assertFalse($cache->get('testkey2'));
 }
开发者ID:Burick,项目名称:moodle,代码行数:18,代码来源:cache_test.php

示例5: test_delete

 public function test_delete()
 {
     $this->search->index();
     $querydata = new stdClass();
     $querydata->q = 'message';
     $this->assertCount(2, $this->search->search($querydata));
     $areaid = \core_search\manager::generate_areaid('core_mocksearch', 'role_capabilities');
     $this->search->delete_index($areaid);
     cache_helper::purge_by_definition('core', 'search_results');
     $this->assertCount(0, $this->search->search($querydata));
 }
开发者ID:rushi963,项目名称:moodle,代码行数:11,代码来源:engine_test.php


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