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 |
Jump to:
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?
| Attachment | Size |
|---|---|
| simplepie_enablecache.patch | 1.16 KB |

#1
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
The most of this patch is committed. The caching is turned on by default of course.
#3
Automatically closed -- issue fixed for two weeks with no activity.