I'm using simpleXML to go through the XML results of a Twitter XML file, but I'm completely lost as to caching the results with PHP. This article seems to be of some help, but I've come across memcache (and memcached. C'mon, namers.) as well, and I have no idea what to do.
I'm using this:
$sxml = simplexml_load_file(
'http://api.twitter.com/1/qworky/lists/qworkyteam/statuses.xml');
foreach($sxml->status as $status){
$name = $status->user->name;
$image = $status->user->profile_image_url;
$update = $status->text;
$url = "http://twitter.com/" . $status->user->screen_name;
}
to simply store the XML data of a Twitter list into usable variables. But what's the right thing to do? Create a cache file and only run this block of PHP if the cache file is older than ten minutes, otherwise serve up the cached variables? How do I pass the cached variables back-and-forth between the cached file and the DOM? Heck, what kind of extension and filename does a cache file have?
Thanks so much for any way you can point me in a healthy direction here.