RSS feed cache not getting reset on new content
hadsie - October 6, 2009 - 13:00
| Project: | Boost |
| Version: | 6.x-1.x-dev |
| Component: | Caching logic |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When I add new content to my site (promoted to front page) everything seems to reload fine with the exception of the anonymous RSS feed.
I can view the new content on my site as anonymous or authenticated, and the RSS feed is complete for authenticated users. But when I try and view the RSS feed as an anonymous user the most recent post will be missing. Upon clearing the sites cache the RSS feed for anonymous begins working.
Is there something I can do to configure the RSS cache for anon to be cleared after new content is added?
Thanks!
Scott

#1
<?php
/**
* Expires the static file cache for a given page, or multiple pages
* matching a wildcard.
*
* @param $path
* Current URL
* @param $wildcard
* If true get all chached files that start with this path.
*
* TODO: Replace glob() with a database operation.
*/
function boost_cache_expire($path, $wildcard = FALSE) {
// Sanity check
if (boost_file_path($path, FALSE) === FALSE) {
return FALSE;
}
// Get list of related files
$tempA = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_FILE_EXTENSION, GLOB_NOSORT);
$tempB = glob(boost_file_path($path, FALSE, NULL) . (($wildcard) ? '*' : '') . BOOST_XML_EXTENSION, GLOB_NOSORT);
if (!empty($tempA) && !empty($tempB)) {
$filenames = array_filter(array_merge($tempA, $tempB));
}
elseif (!empty($tempA)) {
$filenames = $tempA;
}
elseif (!empty($tempB)) {
$filenames = $tempB;
}
else {
return FALSE;
}
if (empty($filenames)) {
return FALSE;
}
// Flush expired files
foreach ($filenames as $filename) {
boost_cache_kill($filename);
}
return TRUE;
}
?>
Looks like I need to replace glob with a database operation.
In short the front page rss feed is called feed_.xml in the boost cache; the html is called _.html. Doing a file search for the front page doesn't work too well in this case.
#2
boost_cache_expire_derivative() will have to be redone; boost_cache_expire() might be killed. boost_cache_expire_derivative() will directly call boost_cache_kill().
When boost_cache_expire_derivative() is called will find aliases & redirects so it can find a matching filename in the database. Once a match is found, it then gets the page_callback, page_arguments and page_id; searching the database that match all 3. These are the files in the cache that need to be expired. Should cover html, xml, and ajax & url variables.
#3
This patch is for the latest dev. It can't be done very easily without the latest changes that have gone in.
#4
committed
#5
Thanks! Just updated to the .11 version, I'll report back if I have any problems.
#6
After updating it still seems like the issue is there. Should I be using the dev version to resolve this?
#7
No, I'll have to write in a special front page handler. What's the URL of your front page feed?
#8
it's
/rss.xmlcorrect?Only holds content promoted to the front page right?
#9
fixed some bugs in here as well.
#10
more bug fixing...
#11
committed
#12
that's right, it's the promoted to front page stuff. i'll try out this fix shortly, thanks so much!
#13
grab 6.x-1.12 ;)
#14
Automatically closed -- issue fixed for 2 weeks with no activity.