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


PHP Cache::clearGroup方法代码示例

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


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

示例1: _clearCacheGroup

 /**
  * Clear cache group.
  *
  * @return void
  */
 protected function _clearCacheGroup()
 {
     $cacheGroups = $this->config('groups');
     foreach ($cacheGroups as $group) {
         Cache::clearGroup($group, $this->config('config'));
     }
 }
开发者ID:UnionCMS,项目名称:Core,代码行数:12,代码来源:CachedBehavior.php

示例2: testGroupClear

 /**
  * Test clearing a cache group
  *
  * @return void
  */
 public function testGroupClear()
 {
     Cache::config('memcached_groups', ['engine' => 'Memcached', 'duration' => 3600, 'groups' => ['group_a', 'group_b']]);
     $this->assertTrue(Cache::write('test_groups', 'value', 'memcached_groups'));
     $this->assertTrue(Cache::clearGroup('group_a', 'memcached_groups'));
     $this->assertFalse(Cache::read('test_groups', 'memcached_groups'));
     $this->assertTrue(Cache::write('test_groups', 'value2', 'memcached_groups'));
     $this->assertTrue(Cache::clearGroup('group_b', 'memcached_groups'));
     $this->assertFalse(Cache::read('test_groups', 'memcached_groups'));
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:15,代码来源:MemcachedEngineTest.php

示例3: testGroupClear

 /**
  * Test clearing a cache group
  *
  * @return void
  */
 public function testGroupClear()
 {
     Cache::config('apc_groups', array('engine' => 'Apc', 'duration' => 0, 'groups' => array('group_a', 'group_b'), 'prefix' => 'test_'));
     $this->assertTrue(Cache::write('test_groups', 'value', 'apc_groups'));
     $this->assertTrue(Cache::clearGroup('group_a', 'apc_groups'));
     $this->assertFalse(Cache::read('test_groups', 'apc_groups'));
     $this->assertTrue(Cache::write('test_groups', 'value2', 'apc_groups'));
     $this->assertTrue(Cache::clearGroup('group_b', 'apc_groups'));
     $this->assertFalse(Cache::read('test_groups', 'apc_groups'));
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:15,代码来源:ApcEngineTest.php

示例4: testGroupClearNoPrefix

 /**
  * Test that clearGroup works with no prefix.
  *
  * @return void
  */
 public function testGroupClearNoPrefix()
 {
     Cache::config('file_groups', ['className' => 'File', 'duration' => 3600, 'prefix' => '', 'groups' => ['group_a', 'group_b']]);
     Cache::write('key_1', 'value', 'file_groups');
     Cache::write('key_2', 'value', 'file_groups');
     Cache::clearGroup('group_a', 'file_groups');
     $this->assertFalse(Cache::read('key_1', 'file_groups'), 'Did not delete');
     $this->assertFalse(Cache::read('key_2', 'file_groups'), 'Did not delete');
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:14,代码来源:FileEngineTest.php

示例5: home

 /**
  * Toggle home link.
  *
  * @param null $id
  * @return \Cake\Network\Response|void
  */
 public function home($id = null)
 {
     $link = $this->Links->get($id);
     $this->Links->updateAll(['home' => UN_PUBLISH_STATUS], ['home' => PUBLISH_STATUS]);
     $link->status = PUBLISH_STATUS;
     $link->home = PUBLISH_STATUS;
     $cacheKey = $cacheGroup = 'home_link';
     if ($result = $this->Links->save($link)) {
         Cache::clearGroup($cacheKey, $cacheGroup);
         Cache::write($cacheKey, $result, $cacheGroup);
         $this->Flash->success(__d('menus', 'The link «{0}» has bee set how home.', sprintf('<strong>%s</strong>', $link->title)));
     } else {
         $this->Flash->error(__d('menus', 'An error has occurred. Please, try again.'));
     }
     return $this->redirect(['action' => 'index', '?' => ['menu_id' => $link->menu_id]]);
 }
开发者ID:Cheren,项目名称:union,代码行数:22,代码来源:LinksController.php

示例6: export

 public function export()
 {
     if ($this->request->is('post')) {
         $listLang = [];
         foreach (Configure::read('Core.System.language') as $key => $item) {
             $listLang = array_merge($listLang, [$key => $item['key']]);
         }
         $lang = $this->request->data['language'];
         $list = $this->Languages->find();
         $content = "";
         $path = APP . "Locale/{$listLang[$lang]}/default.po";
         foreach ($list as $item) {
             $content .= 'msgid "' . $item->key . '"' . "\n" . 'msgstr "' . $item->{$lang} . '"' . "\n";
         }
         if ($File = new File($path, true, 0777)) {
             $File->write($content);
             Cache::clearGroup('persistent');
             $this->Flash->success(__('language exported', true));
         } else {
             $this->Flash->error(__('language can not be exported', true));
         }
         $this->redirect(array('action' => 'index'));
     }
 }
开发者ID:nguyennghiem1205,项目名称:Wss,代码行数:24,代码来源:LanguagesController.php

示例7: testGroupClear

 /**
  * Test clearing a cache group
  *
  * @return void
  */
 public function testGroupClear()
 {
     Cache::config('wincache_groups', ['engine' => 'Wincache', 'duration' => 0, 'groups' => ['group_a', 'group_b'], 'prefix' => 'test_']);
     $this->assertTrue(Cache::write('test_groups', 'value', 'wincache_groups'));
     $this->assertTrue(Cache::clearGroup('group_a', 'wincache_groups'));
     $this->assertFalse(Cache::read('test_groups', 'wincache_groups'));
     $this->assertTrue(Cache::write('test_groups', 'value2', 'wincache_groups'));
     $this->assertTrue(Cache::clearGroup('group_b', 'wincache_groups'));
     $this->assertFalse(Cache::read('test_groups', 'wincache_groups'));
 }
开发者ID:KarimaLadhani,项目名称:cakephp,代码行数:15,代码来源:WincacheEngineTest.php

示例8: clearCache

 /**
  * Clear blocks cache for all themes and all regions.
  *
  * @return void
  */
 public function clearCache()
 {
     Cache::clearGroup('views', 'blocks');
 }
开发者ID:quickapps-plugins,项目名称:block,代码行数:9,代码来源:BlocksTable.php

示例9: clearCache

 /**
  * Clear menus cache.
  *
  * @return void
  */
 public function clearCache()
 {
     Cache::clearGroup('views', 'menus');
 }
开发者ID:quickapps-plugins,项目名称:menu,代码行数:9,代码来源:MenuLinksTable.php

示例10: clearCache

 /**
  * Clear permissions cache for all users.
  *
  * @return void
  */
 public function clearCache()
 {
     Cache::clearGroup('acl', 'permissions');
 }
开发者ID:quickapps-plugins,项目名称:user,代码行数:9,代码来源:PermissionsTable.php


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