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


PHP JCache::remove方法代码示例

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


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

示例1: checkCache

 function checkCache()
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if ($this->_recache) {
         $this->_cache->remove($this->_cache_key);
         return;
     }
     if ($app->isAdmin() || $this->isDisabled() || count($app->getMessageQueue()) || $user->get('admin') || $app->input->getMethod() !== 'GET') {
         return;
     }
     $data = $this->_cache->get($this->_cache_key);
     if (false === strpos($data, sprintf('cached:%d', $this->_cache_version))) {
         // Logger::d('ERROR: Cache version mismatch');
         return;
     }
     if ($data !== false) {
         // Set cached body.
         $app->setBody($data);
         echo $app->toString($app->get('gzip'));
         // Logger::d(__METHOD__.' from cache');
         $app->close();
         exit;
     }
 }
开发者ID:rustyJ4ck,项目名称:joomla-page-cache,代码行数:25,代码来源:cache.new.php

示例2: isOutputExpired

 /**
  * @param $checksum
  *
  * @return bool|mixed
  */
 protected function isOutputExpired(RokBooster_Compressor_IGroup $group, $is_wrapped = true)
 {
     $oc = RokBooster_Compressor_OutputContainerFactory::create($group, $this->options);
     if (!$oc->doesExist($is_wrapped)) {
         return true;
     }
     if ($expired = $oc->isExpired($is_wrapped)) {
         $files_changed = false;
         if ($file_group = $this->file_info_cache->get($group->getChecksum() . '_fileinfo')) {
             $file_group = unserialize($file_group);
             /** @var $file RokBooster_Compressor_File */
             foreach ($file_group as $file) {
                 if (file_exists($file->getPath()) && is_readable($file->getPath())) {
                     if ($file->hasChanged()) {
                         $files_changed = true;
                         break;
                     }
                 } else {
                     $this->file_info_cache->remove($group->getChecksum() . '_fileinfo');
                     $files_changed = true;
                     break;
                 }
             }
         } else {
             $files_changed = true;
         }
         if (!$files_changed) {
             $oc->setAsValid();
             return false;
         }
     }
     return $expired;
 }
开发者ID:rogatnev-nikita,项目名称:cloudinterpreter,代码行数:38,代码来源:AbstractStrategy.php

示例3: isCacheExpired

 /**
  * @param $checksum
  *
  * @return bool|mixed
  */
 protected function isCacheExpired($checksum)
 {
     if (!$this->cache->doesCacheExist($checksum)) {
         return true;
     }
     if ($expired = $this->cache->isCacheExpired($checksum)) {
         $files_changed = false;
         if ($file_group = $this->file_info_cache->get($checksum . '_fileinfo')) {
             $file_group = unserialize($file_group);
             /** @var $file RokBooster_Compressor_File */
             foreach ($file_group as $file) {
                 if (file_exists($file->getPath()) && is_readable($file->getPath())) {
                     if ($file->hasChanged()) {
                         $files_changed = true;
                         break;
                     }
                 } else {
                     $this->file_info_cache->remove($checksum . '_fileinfo');
                     $files_changed = true;
                     break;
                 }
             }
         } else {
             $files_changed = true;
         }
         if (!$files_changed) {
             $this->cache->setCacheAsValid($checksum);
             return false;
         }
     }
     return $expired;
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:37,代码来源:AbstractStrategy.php

示例4: save

 function save($content, $id)
 {
     // Store the cache string
     for ($i = 0; $i < 5; $i++) {
         if (parent::store(serialize($content), $id)) {
             return;
         }
     }
     parent::remove($id);
 }
开发者ID:affiliatelk,项目名称:ecc,代码行数:10,代码来源:cache.php

示例5: testRemove

 /**
  * Testing remove().
  *
  * @return void
  */
 public function testRemove()
 {
     $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->remove(43, ''), $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->equalTo('Now is the time for all good people to throw a party.'), 'Should retrieve the data properly');
 }
开发者ID:ramdesh,项目名称:joomla-platform,代码行数:17,代码来源:JCacheTest.php

示例6: testRemove

 /**
  * Testing remove().
  *
  * @return void
  */
 public function testRemove()
 {
     $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->remove(43, ''));
     $this->assertFalse($this->object->get(43, ''));
     $this->assertEquals($this->testData_A, $this->object->get(42, ''));
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:17,代码来源:JCacheTest.php

示例7: fetchXML

 static function fetchXML($params, $force = 0)
 {
     $rssurl = $params->get('rss_url', '');
     $items_limit = intval($params->get('items_limit', 10));
     $doCache = intval($params->get('scr_cache', 1));
     $CacheTime = intval($params->get('cache_time', 3600));
     $twitter_timeline = $params->get('twitter_timeline', 'user');
     $username = $params->get('twitter_username', '');
     $password = $params->get('twitter_password', '');
     $list = $params->get('twitter_list', '');
     if ($twitter_timeline == 'friends') {
         $rssurl = 'http://api.twitter.com/1/statuses/friends_timeline.xml';
     } else {
         if ($twitter_timeline == 'mentions') {
             $rssurl = 'http://api.twitter.com/1/statuses/mentions.xml';
         } else {
             if ($twitter_timeline == 'list') {
                 $rssurl = 'http://api.twitter.com/1/' . urlencode($username) . '/lists/' . urlencode($list) . '/statuses.xml';
             } else {
                 if ($twitter_timeline == 'user_rt' && $username != '') {
                     $rssurl = 'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=' . urlencode($username) . '&include_rts=true';
                 } else {
                     if ($username != '') {
                         $rssurl = 'http://api.twitter.com/1/statuses/user_timeline/' . urlencode($username) . '.xml';
                     } else {
                         $rssurl = str_replace('.rss', '.xml', $rssurl);
                     }
                 }
             }
         }
     }
     $feed_desc = 1;
     $item_desc = 1;
     $feed_array = array();
     $xmlDoc =& JFactory::getXMLParser('Simple');
     if ($doCache) {
         if (!class_exists('JCache')) {
             require_once JPATH_SITE . DS . 'libraries' . DS . 'joomla' . DS . 'cache' . DS . 'cache.php';
         }
         $options = array('defaultgroup' => 'mod_ajaxscroller', 'lifetime' => $CacheTime, 'checkTime' => true, 'caching' => true);
         $cache = new JCache($options);
         $cache->setLifeTime($CacheTime);
         if ($force) {
             // delete the cache, force the new fetch
             $cache->remove(md5($rssurl), 'mod_ajaxscroller');
         }
         if ($string = $cache->get(md5($rssurl), 'mod_ajaxscroller')) {
             $xmlDoc->loadString($string);
         } else {
             $xml = simplexml_load_file($rssurl);
             $string = $xml->asXML();
             $string = str_replace('georss:', 'georss_', $string);
             // simplexml doesn't like ':'
             $xmlDoc->loadString($string);
             $cache->store($xmlDoc->document->toString(), md5($rssurl));
         }
     } else {
         $xml = simplexml_load_file($rssurl);
         $string = $xml->asXML();
         $string = str_replace('georss:', 'georss_', $string);
         // simplexml doesn't like ':'
         $xmlDoc->loadString($string);
     }
     $root =& $xmlDoc->document;
     $statuses =& $root->children();
     $length = count($statuses);
     $total = $items_limit && $items_limit < $length ? $items_limit : $length;
     if ($total == 0) {
         $feed_array = $xmlDoc->loadString($string);
     }
     for ($i = 0; $i < $total; $i++) {
         $status =& $statuses[$i];
         $id =& $status->getElementByPath('id')->data();
         $created_at =& $status->getElementByPath('created_at')->data();
         $text =& $status->getElementByPath('text')->data();
         $source =& $status->getElementByPath('source')->data();
         $in_reply_to_status_id =& $status->getElementByPath('in_reply_to_status_id')->data();
         $in_reply_to_user_id =& $status->getElementByPath('in_reply_to_user_id')->data();
         $in_reply_to_screen_name =& $status->getElementByPath('in_reply_to_screen_name')->data();
         $user_id =& $status->getElementByPath('user')->getElementByPath('id')->data();
         $user_screen_name =& $status->getElementByPath('user')->getElementByPath('screen_name')->data();
         $user_profile_image_url =& $status->getElementByPath('user')->getElementByPath('profile_image_url')->data();
         $feed_array[$i]['item_href'] = 'http://twitter.com/' . $user_screen_name . '/statuses/' . $id;
         $feed_array[$i]['item_date'] = $created_at;
         $feed_array[$i]['item_title'] = $user_screen_name;
         //$text = htmlentities($text);
         $feed_array[$i]['item_desc'] = modAjaxScrollerCommonHelper::ajax_scroller_format_twitter($text, $params, $user_profile_image_url, $user_screen_name, $created_at, $source, $in_reply_to_user_id, $in_reply_to_screen_name, $in_reply_to_status_id);
     }
     return $feed_array;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:90,代码来源:twitter.php

示例8: clearCache

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


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