CodeIgniter Forums
XML Caching help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: XML Caching help (/showthread.php?tid=32530)



XML Caching help - El Forum - 07-26-2010

[eluser]Unknown[/eluser]
As a CI newbie I'm looking for some advice on how best to deal with external XML feeds.

I'm pulling ~10 XML feeds, each with 100-200 items in different layouts from various sources with a view to consolidating, filtering and displaying them based on user preferences.

These XML feeds are constantly updated and pulling all feeds can take a few seconds which is far from ideal. What I would like to do is to cache the feeds for 2-5 minutes but would like to know:

a) Should I cache the results to a MySQL database or to the filesystem (in a single XML file)?
b) What is the best method of automating the data pull? i.e. cron job or other...

and why? (I always want to know why!!!)

Thanks in advance.


XML Caching help - El Forum - 07-26-2010

[eluser]pickupman[/eluser]
Use Phil Sturgeon's Cache library linked in my signature. I use for a very similar reason. You can cache any model or library call. I wrote a library to fetch feeds via curl, then use the cache library to cache the results. You can set any time limit.