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


PHP JCache::clean方法代码示例

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


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

示例1: testClean

 /**
  * Testing clean().
  *
  * @return void
  */
 public function testClean()
 {
     $options = array('storage' => 'file');
     $this->object = JCache::getInstance('output', $options);
     $this->object->setCaching(true);
     $this->object->store('Now is the time for all good people to throw a party.', 42, '');
     $this->object->store('And this is the cache that tries men\'s souls', 43, '');
     $this->assertThat($this->object->get(43, ''), $this->equalTo('And this is the cache that tries men\'s souls'), 'Should retrieve the data properly');
     $this->assertThat($this->object->clean(''), $this->isTrue(), 'Should remove cached data');
     $this->assertThat($this->object->get(43, ''), $this->isFalse(), 'Should not retrieve the data properly');
     $this->assertThat($this->object->get(42, ''), $this->isFalse(), 'Should not retrieve the data properly');
 }
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:17,代码来源:JCacheTest.php

示例2: testClean

 /**
  * Testing clean().
  *
  * @return void
  */
 public function testClean()
 {
     $options = array('storage' => 'file');
     $this->object = JCache::getInstance('output', $options);
     $this->object->setCaching(true);
     $this->object->store($this->testData_A, 42, '');
     $this->object->store($this->testData_B, 43, '');
     $this->assertEquals($this->testData_B, $this->object->get(43, ''));
     $this->assertTrue($this->object->clean(''));
     $this->assertFalse($this->object->get(43, ''));
     $this->assertFalse($this->object->get(42, ''));
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:17,代码来源:JCacheTest.php

示例3: render

 /**
  * Display the application.
  */
 public function render()
 {
     $user = JFactory::getUser();
     $conf = JFactory::getConfig();
     if ($user->id != 0) {
         // generate and empty object
         $plgParams = new JRegistry();
         // get plugin details
         $plugin = JPluginHelper::getPlugin('system', 'rokbooster');
         // load params into our params object
         if ($plugin && isset($plugin->params)) {
             $plgParams->loadString($plugin->params);
         }
         if ($user->authorise('core.admin', 'com_cache')) {
             $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_CACHE));
             $file_info_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => false));
             $generator_state_cache = new JCache(array('cachebase' => $conf->get('cache_path', JPATH_CACHE), 'lifetime' => 120, 'storage' => $conf->get('cache_handler', 'file'), 'defaultgroup' => 'rokbooster', 'locking' => true, 'locktime' => 15, 'checkTime' => true, 'caching' => true));
             $generator_state_cache->clean();
             $file_cache->clean();
             $file_info_cache->clean();
             $files = $file_cache->getAll();
             $filecount = 0;
             if (is_array($files) && array_key_exists('rokbooster', $files)) {
                 $filecount = $files['rokbooster']->count;
             }
             if ($plgParams->get('data_storage', 'default') == 'apc' && function_exists('apc_store')) {
                 $config = JFactory::getConfig();
                 $hash = preg_quote(md5($config->get('secret')));
                 if (class_exists('APCIterator')) {
                     $entries = new APCIterator('user', "/^{$hash}-rokbooster-dataentry-/");
                     apc_delete($entries);
                 } else {
                     $info = apc_cache_info('user');
                     foreach ($info['cache_list'] as $apc_cache_entry) {
                         if (strpos($apc_cache_entry['info'], "{$hash}-rokbooster-dataentry-") === 0) {
                             apc_delete($apc_cache_entry['info']);
                         }
                     }
                 }
             }
             echo sprintf('{"status":"success","message":"%d"}', $filecount);
         } else {
             echo '{"status": "error","message":"You do not have permissions to clear cache."}';
         }
     }
 }
开发者ID:naka211,项目名称:myloyal,代码行数:49,代码来源:application.php

示例4: render

 /**
  * Display the application.
  */
 public function render()
 {
     $user = JFactory::getUser();
     $conf = JFactory::getConfig();
     if ($user->id != 0) {
         if ($user->authorise('core.admin', 'com_cache')) {
             $file_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => true, 'storage' => 'file', 'cachebase' => JPATH_CACHE));
             $file_info_cache = new JCache(array('defaultgroup' => 'rokbooster', 'caching' => true, 'checkTime' => false));
             $generator_state_cache = new JCache(array('cachebase' => $conf->get('cache_path', JPATH_CACHE), 'lifetime' => 120, 'storage' => $conf->get('cache_handler', 'file'), 'defaultgroup' => 'rokbooster', 'locking' => true, 'locktime' => 15, 'checkTime' => true, 'caching' => true));
             $generator_state_cache->clean();
             $file_cache->clean();
             $file_info_cache->clean();
             $files = $file_cache->getAll();
             $filecount = 0;
             if (is_array($files) && array_key_exists('rokbooster', $files)) {
                 $filecount = $files['rokbooster']->count;
             }
             echo sprintf('{"status":"success","message":"%d"}', $filecount);
         } else {
             echo '{"status": "error","message":"You do not have permissions to clear cache."}';
         }
     }
 }
开发者ID:interfaceslivres,项目名称:ccmd-ufpb,代码行数:26,代码来源:application.php

示例5: clearGroupCache

 /**
  * Clears cache of specified group
  *
  * @param string $groupName Name of group
  *
  * @return boolean
  */
 public function clearGroupCache($groupName)
 {
     return $this->cache->clean($groupName);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:11,代码来源:joomlaCacheDriver.class.php


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