public function _replyToRenewSimplePieCaches($vURLs) { // Setup Caches $oFeed = new AmazonAutoLinks_SimplePie(); // Set urls $oFeed->set_feed_url($vURLs); // this should be set after defining $vURLs $oFeed->set_cache_duration(0); // 0 seconds, means renew the cache right away. // Set the background flag to True so that it won't trigger the event action recursively. $oFeed->setBackground(true); $oFeed->init(); }
/** * * @callback action aal_action_simplepie_renew_cache */ public function doAction() { $_aParams = func_get_args() + array(null); $asURLs = $_aParams[0]; // Set up Caches $_oFeed = new AmazonAutoLinks_SimplePie(); // Set urls $_oFeed->set_feed_url($asURLs); // this should be set after defining $asURLs // 0 seconds, means renew the cache right away. $_oFeed->set_cache_duration(0); // Set the background flag to True so that it won't trigger the event action recursively. $_oFeed->setBackground(true); $_oFeed->init(); }
/** * Sets up SimplePie object. * * @param integer $iCacheDuration // 60 seconds * 60 = 1 hour, 1800 = 30 minutes */ protected function getFeedObj($aUrls, $iItem = 10, $iCacheDuration = 36000) { // Reuse the object that already exists. This conserves the memory usage. // $this->oFeed = isset( $this->oFeed ) ? $this->oFeed : new AmazonAutoLinks_SimplePie; // $oFeed = $this->oFeed; // // For excluding sub categories, new instances need to be instantiated per set of uls as SimplePie somehow does not // property output newly fetched items. $_oFeed = new AmazonAutoLinks_SimplePie(); // Set sort type. $_oFeed->set_sortorder($this->oUnitOption->get('sort')); $_oFeed->set_charset_for_sort($this->sCharEncoding); $_oFeed->set_keeprawtitle($this->oUnitOption->get('keep_raw_title')); // Set urls $_oFeed->set_feed_url($aUrls); $_oFeed->set_item_limit($iItem); // This should be set after defining $urls $_oFeed->set_cache_duration($iCacheDuration); $_oFeed->set_stupidly_fast(true); // If the cache lifetime is explicitly set to 0, do not trigger the background renewal cache event if (0 == $iCacheDuration) { // setting it true will be considered the background process; thus, it won't trigger the renewal event. $_oFeed->setBackground(true); } // set_stupidly_fast() disables this internally so turn it on manually because it will trigger the custom sort method $_oFeed->enable_order_by_date(true); // $_oFeed->file_class = 'AmazonAutoLinks_SimplePie_File'; // this is assigned in the class definition already $_oFeed->init(); // will perform fetching the feeds. return $_oFeed; }