SimplePie Parser: Disable caching

srhaber - December 2, 2008 - 01:13
Project:FeedAPI
Version:6.x-1.x-dev
Component:Code parser_simplepie
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

My feeds weren't updating on Refreshes consistently, so I suspected something was being cached somewhere. Sure enough, lines 53-54 in parser_simplepie.module suggest to disable simplepie caching:

// Here we do not allow caching. Otherwise simplepie's cache prevents FeedAPI to process the feed
$parser = _parser_simplepie_get_parser($url, FALSE);

Problem is, despite that comment and passed boolean parameter (FALSE), the _parser_simplepie_get_parser function is defined with only 1 passed argument ($url).

I created a patch to honor this boolean parameter and disable simplepie caching. This worked for me as expected. Curious if anyone else has encountered this issue?

AttachmentSize
simplepie_enablecache.patch1.16 KB

#1

alex_b - December 4, 2008 - 04:45
Component:Code» Code parser_simplepie
Status:needs review» needs work

The second part of the patch

-function _parser_simplepie_get_parser($url) {
+function _parser_simplepie_get_parser($url, $enable_cache=TRUE) {
//...
-  $parser->enable_cache($cache_location !== FALSE ? TRUE : FALSE);
+  $parser->enable_cache($cache_location !== FALSE ? $enable_cache : FALSE);

Looks sane to me.

But I don't think we should turn off caching altogether:

function _parser_simplepie_feedapi_parse($feed) {
-  $parser = _parser_simplepie_get_parser($feed->url);
+  $parser = _parser_simplepie_get_parser($feed->url, FALSE);

How often do your feeds change? Wheren't they not updating over a long time? Did you try deleting the entire cache and did the problem still persist _after_ the first time refreshing?

#2

Aron Novak - December 20, 2008 - 11:15
Status:needs work» fixed

The most of this patch is committed. The caching is turned on by default of course.

#3

System Message - January 3, 2009 - 11:20
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.