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


PHP Cache::clearGroup方法代码示例

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


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

示例1: onAfterBulkProcess

 /**
  * Clear Nodes related cache after bulk operation
  *
  * @param CakeEvent $event
  * @return void
  */
 public function onAfterBulkProcess($event)
 {
     Cache::clearGroup('nodes', 'nodes');
     Cache::clearGroup('nodes', 'nodes_view');
     Cache::clearGroup('nodes', 'nodes_promoted');
     Cache::clearGroup('nodes', 'nodes_term');
     Cache::clearGroup('nodes', 'nodes_index');
 }
开发者ID:saydulk,项目名称:croogo,代码行数:14,代码来源:NodesEventHandler.php

示例2: _deleteCachedFiles

 /**
  * Delete cache files matching prefix
  *
  * @param object $model
  * @return void
  */
 protected function _deleteCachedFiles(Model $model)
 {
     foreach ($this->settings[$model->alias]['groups'] as $group) {
         $configs = CroogoCache::groupConfigs($group);
         foreach ($configs[$group] as $config) {
             Cache::clearGroup($group, $config);
         }
     }
 }
开发者ID:dlpc,项目名称:CakeWX,代码行数:15,代码来源:CachedBehavior.php

示例3: testLinkIsAllowedByUserId

 /**
  * testLinkIsAllowedByUserId
  */
 public function testLinkIsAllowedByUserId()
 {
     Cache::clearGroup('acl', 'permissions');
     $resetUrl = 'controllers/Users/reset';
     $nodeViewUrl = 'controllers/Nodes/view';
     $result = $this->AclHelper->linkIsAllowedByUserId(3, $nodeViewUrl);
     $this->assertTrue($result);
     $result = $this->AclHelper->linkIsAllowedByUserId(3, $resetUrl);
     $this->assertTrue($result);
     $result = $this->AclHelper->linkIsAllowedByUserId(2, $nodeViewUrl);
     $this->assertTrue($result);
     $result = $this->AclHelper->linkIsAllowedByUserId(2, $resetUrl);
     $this->assertTrue($result);
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:17,代码来源:AclHelperTest.php

示例4: testGroupClear

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

示例5: testGroupClear

 /**
  * Test clearing a cache group
  *
  * @return void
  */
 public function testGroupClear()
 {
     Cache::config('wincache_groups', array('engine' => 'Wincache', 'duration' => 0, 'groups' => array('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:jgera,项目名称:orangescrum,代码行数:15,代码来源:WincacheEngineTest.php

示例6: testGroupClearNoPrefix

 /**
  * Test that clearGroup works with no prefix.
  *
  * @return void
  */
 public function testGroupClearNoPrefix()
 {
     Cache::config('file_groups', array('engine' => 'File', 'duration' => 3600, 'prefix' => '', 'groups' => array('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:Demired,项目名称:CakeWX,代码行数:14,代码来源:FileEngineTest.php

示例7: save_permission

 /**
  *
  * @param AclNode $aro_nodes The Aro model hierarchy
  * @param string $aco_path The Aco path to check for
  * @param string $permission_type 'deny' or 'allow', 'grant', depending on what permission (grant or deny) is being set
  */
 public function save_permission($aro_nodes, $aco_path, $permission_type)
 {
     //debug($aro_nodes);debug($aco_path);debug($permission_type);
     if (isset($aro_nodes[0])) {
         $aco_path = 'controllers/' . $aco_path;
         $pk_name = 'id';
         if ($aro_nodes[0]['Aro']['model'] == Configure::read('acl.aro.role.model')) {
             $pk_name = $this->controller->_get_role_primary_key_name();
         } elseif ($aro_nodes[0]['Aro']['model'] == Configure::read('acl.aro.user.model')) {
             $pk_name = $this->controller->_get_user_primary_key_name();
         }
         //clear acl cache
         Cache::clearGroup('acl', Configure::read('CacheDbAclConfig'));
         $aro_model_data = array($aro_nodes[0]['Aro']['model'] => array($pk_name => $aro_nodes[0]['Aro']['foreign_key']));
         $aro_id = $aro_nodes[0]['Aro']['id'];
         $specific_permission_right = $this->get_specific_permission_right($aro_nodes[0], $aco_path);
         $inherited_permission_right = $this->get_first_parent_permission_right($aro_nodes[0], $aco_path);
         if (!isset($inherited_permission_right) && count($aro_nodes) > 1) {
             /*
              * Get the permission inherited by the parent ARO
              */
             $specific_parent_aro_permission_right = $this->get_specific_permission_right($aro_nodes[1], $aco_path);
             if (isset($specific_parent_aro_permission_right)) {
                 /*
                  * If there is a specific permission for the parent ARO on the ACO, the child ARO inheritates this permission
                  */
                 $inherited_permission_right = $specific_parent_aro_permission_right;
             } else {
                 $inherited_permission_right = $this->get_first_parent_permission_right($aro_nodes[1], $aco_path);
             }
         }
         /*
          * Check if the specific permission is necessary to get the correct permission
          */
         if (!isset($inherited_permission_right)) {
             $specific_permission_needed = true;
         } else {
             if ($permission_type == 'allow' || $permission_type == 'grant') {
                 $specific_permission_needed = $inherited_permission_right != 1;
             } else {
                 $specific_permission_needed = $inherited_permission_right == 1;
             }
         }
         if ($specific_permission_needed) {
             if ($permission_type == 'allow' || $permission_type == 'grant') {
                 if ($this->Acl->allow($aro_model_data, $aco_path)) {
                     return true;
                 } else {
                     trigger_error(__d('acl', 'An error occured while saving the specific permission'), E_USER_NOTICE);
                     return false;
                 }
             } else {
                 if ($this->Acl->deny($aro_model_data, $aco_path)) {
                     return true;
                 } else {
                     trigger_error(__d('acl', 'An error occured while saving the specific permission'), E_USER_NOTICE);
                     return false;
                 }
             }
         } elseif (isset($specific_permission_right)) {
             $aco_node = $this->Acl->Aco->node($aco_path);
             if (!empty($aco_node)) {
                 $aco_id = $aco_node[0]['Aco']['id'];
                 $specific_permission = $this->Acl->Aro->Permission->find('first', array('conditions' => array('aro_id' => $aro_id, 'aco_id' => $aco_id)));
                 if (!empty($specific_permission)) {
                     if ($this->Acl->Aro->Permission->delete(array('Permission.id' => $specific_permission['Permission']['id']))) {
                         return true;
                     } else {
                         trigger_error(__d('acl', 'An error occured while deleting the specific permission'), E_USER_NOTICE);
                         return false;
                     }
                 } else {
                     /*
                      * As $specific_permission_right has a value, we should never fall here, but who knows... ;-)
                      */
                     trigger_error(__d('acl', 'The specific permission id could not be retrieved'), E_USER_NOTICE);
                     return false;
                 }
             } else {
                 /*
                  * As $specific_permission_right has a value, we should never fall here, but who knows... ;-)
                  */
                 trigger_error(__d('acl', 'The child ACO id could not be retrieved'), E_USER_NOTICE);
                 return false;
             }
         } else {
             /*
              * Right can be inherited, and no specific permission exists => there is nothing to do...
              */
         }
     } else {
         trigger_error(__d('acl', 'Invalid ARO'), E_USER_NOTICE);
         return false;
     }
//.........这里部分代码省略.........
开发者ID:magooemp,项目名称:eramba,代码行数:101,代码来源:AclManagerComponent.php

示例8: testGroupClear

 /**
  * Test clearing a cache group
  *
  * @return void
  */
 public function testGroupClear()
 {
     Cache::config('file_groups', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a', 'group_b')));
     Cache::config('file_groups2', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_b')));
     Cache::config('file_groups3', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a')));
     $this->assertTrue(Cache::write('test_groups', 'value', 'file_groups'));
     $this->assertTrue(Cache::write('test_groups2', 'value', 'file_groups2'));
     $this->assertTrue(Cache::write('test_groups3', 'value', 'file_groups3'));
     $this->assertTrue(Cache::clearGroup('group_a', 'file_groups'));
     $this->assertFalse(Cache::read('test_groups', 'file_groups'));
     $this->assertEquals('value', Cache::read('test_groups2', 'file_groups2'));
     $this->assertFalse(Cache::read('test_groups3', 'file_groups3'));
     $this->assertTrue(Cache::write('test_groups4', 'value', 'file_groups'));
     $this->assertTrue(Cache::write('test_groups5', 'value', 'file_groups2'));
     $this->assertTrue(Cache::write('test_groups6', 'value', 'file_groups3'));
     $this->assertTrue(Cache::clearGroup('group_b', 'file_groups'));
     $this->assertFalse(Cache::read('test_groups4', 'file_groups'));
     $this->assertFalse(Cache::read('test_groups5', 'file_groups2'));
     $this->assertEquals('value', Cache::read('test_groups6', 'file_groups3'));
 }
开发者ID:cc2i,项目名称:calibrephp,代码行数:25,代码来源:FileEngineTest.php

示例9: admin_movedown

 /**
  * Admin movedown
  *
  * @param integer $id
  * @param integer $step
  * @return void
  * @access public
  */
 public function admin_movedown($id, $step = 1)
 {
     $link = $this->Link->findById($id);
     if (!isset($link['Link']['id'])) {
         $this->Session->setFlash(__d('croogo', 'Invalid id for Link'), 'default', array('class' => 'error'));
         $this->redirect(array('controller' => 'menus', 'action' => 'index'));
     }
     $this->__scopeTreeToMenu($link['Link']['menu_id']);
     if ($this->Link->moveDown($id, $step)) {
         Cache::clearGroup('menus', 'croogo_menus');
         $this->Session->setFlash(__d('croogo', 'Moved down successfully'), 'default', array('class' => 'success'));
     } else {
         $this->Session->setFlash(__d('croogo', 'Could not move down'), 'default', array('class' => 'error'));
     }
     $this->redirect(array('action' => 'index', '?' => array('menu_id' => $link['Link']['menu_id'])));
 }
开发者ID:Demired,项目名称:CakeWX,代码行数:24,代码来源:LinksController.php

示例10: afterDelete

 /**
  * afterDelete
  */
 public function afterDelete(Model $model)
 {
     Cache::clearGroup('acl', 'permissions');
 }
开发者ID:saydulk,项目名称:croogo,代码行数:7,代码来源:RoleAroBehavior.php

示例11: aco_update

 /**
  * Updates the Aco Tree with new controller actions.
  *
  * @return void
  **/
 public function aco_update($params = array())
 {
     $root = $this->_checkNode($this->rootNode, $this->rootNode, null);
     if (empty($params['plugin'])) {
         $controllers = $this->getControllerList();
         $this->_updateControllers($root, $controllers);
         $plugins = CakePlugin::loaded();
     } else {
         $plugin = $params['plugin'];
         if (!in_array($plugin, App::objects('plugin')) || !CakePlugin::loaded($plugin)) {
             $this->err(__d('croogo', '<error>Plugin %s not found or not activated</error>', $plugin));
             return false;
         }
         $plugins = array($params['plugin']);
     }
     foreach ($plugins as $plugin) {
         $controllers = $this->getControllerList($plugin);
         $path = $this->rootNode . '/' . $plugin;
         $pluginRoot = $this->_checkNode($path, $plugin, $root['Aco']['id']);
         $this->_updateControllers($pluginRoot, $controllers, $plugin);
         $this->_updateApiComponents($controllers, $plugin);
     }
     Cache::clearGroup('acl', 'permissions');
     if ($this->_clean) {
         $this->out(__d('croogo', '<success>Aco Sync Complete</success>'));
     } else {
         $this->out(__d('croogo', '<success>Aco Update Complete</success>'));
     }
     return true;
 }
开发者ID:saydulk,项目名称:croogo,代码行数:35,代码来源:AclExtras.php

示例12: afterSave

 public function afterSave($created, $options = array())
 {
     Cache::clearGroup('admin_menus', 'admin_menus');
 }
开发者ID:bramas,项目名称:cakephp2-admin,代码行数:4,代码来源:Menu.php

示例13: afterSave

 /**
  * afterSave
  */
 public function afterSave($created, $options = array())
 {
     Cache::clearGroup('acl', 'permissions');
 }
开发者ID:dlpc,项目名称:CakeWX,代码行数:7,代码来源:AclPermission.php

示例14: onAfterBulkProcess

 /**
  * Clear Links related cache after bulk operation
  *
  * @param CakeEvent $event
  * @return void
  */
 public function onAfterBulkProcess($event)
 {
     Cache::clearGroup('menus', 'croogo_menus');
 }
开发者ID:saydulk,项目名称:croogo,代码行数:10,代码来源:MenusEventHandler.php

示例15: afterDelete

 /**
  * afterDelete Callback
  *
  * Invalidates the cache group for this model.
  *
  * @param Model $model Model the callback was run on.
  * @return void
  */
 public function afterDelete(Model $model)
 {
     $cacheGroupName = $this->runtime[$model->alias]['default_cache'];
     $cacheName = $cacheGroupName;
     Cache::clearGroup($cacheGroupName, $cacheName);
 }
开发者ID:twostars,项目名称:CakephpAutocachePlugin,代码行数:14,代码来源:AutocacheBehavior.php


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