Single or multiple feed aggregation?
I recently published a beta version of my feeds plugin for CakePHP. This plugin was previously the FeedAggregator component, but it made more sense to break it up into a datasource and model, and finally package as a plugin. The datasource is pretty straight forward as it accepts an array of URLs (RSS feeds), fetches each one through an HTTP request, parses the XML into an array, and then returns the result. The model is simply there for your convenience.
Now the dilemma I am running into is whether or not the datasource should only parse one feed at a time or multiple feeds (currently this). It can go either way: the datasource parses multiple feeds and uses the model to return them, or the datasource parses one feed and the model manages multiple connections and merging. Now the big question for you guys... Should the datasource parse one feed at a time or multiple feeds?
Currently you use the model to pass an array of URLs (through the conditions option), the limit, which fields (elements in the XML) you want returned, and some cache/feed settings. Here is a quick example:
// Multiple feed parsing
$feeds = $this->Aggregator->find('all', array(
'conditions' => array(
'Starcraft 2 Armory' => 'http://feeds.feedburner.com/starcraft',
'Miles Johnson' => 'http://feeds.feedburner.com/milesj'
),
'feed' => array(
'cache' => 'feedCacheKey',
'expires' => '+24 hours',
'explicit' => true
)
));
And I am assuming single feed parsing would look something like this:
$feed = $this->Aggregator->find('first', array(
'conditions' => array('http://feeds.feedburner.com/milesj'),
'feed' => array(
'cache' => 'feedCacheKey',
'expires' => '+24 hours',
'explicit' => true
)
));
I am kind of split on how I should go about this and would really love your opinion. I am currently leaning towards multiple feed parsing (current implementation), but if someone has a good argument in not doing so, I will change it.