2
votes

I'm trying to build an RSS feed, I have no idea about how RSS readers work.

Here's my problem:

RSS readers "polls" RSS feeds that they are subscribed to regularly (from every 15mins to every day) right?

If I implement my feed like this:

for content.php:

<?php
  update_content();
  set_feed_content();
  set_feed_timestamp();
  store_feed_to_db();
?>

for rss.php:

<?php
  get_the_latest_feed_from_db();
  generate_valid_xml();
  output_feed();
?>

Then if I publish feed A now and publish feed B 16 mins later, RSS Readers that poll every 15mins will get feed A and feed B but RSS Readers that polls at an interval greater than that will only get feed B, right? So now you see where I am going.

This is what I think the solution would be

for rss.php:
<?php
  get_x_number_feeds_sorted_by_timestamps();
  generate_valid_xml();
  output_feeds();
?>

So the problem is now for RSS Readers who poll too often, they will get the same result set over and over. How do RSS Readers deal with this? Do they actually check feed contents and compare it with their "cache"? Wouldn't that be a waste of cycles? Or is that really how RSS readers work?

1

1 Answers

1
votes

Most rss feeds include something like that:

<pubDate>Fri, 07 Oct 2011 09:14:56 +0000</pubDate>
<lastBuildDate>Fri, 07 Oct 2011 09:14:56 +0000</lastBuildDate>

You can just check this and do nothing if nothing changed.

lastBuildDate: The last time the content of the channel changed.
pubDate: The publication date for the content in the channel.

-> http://cyber.law.harvard.edu/rss/rss.html