當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。