Jump to content

Cache XML files - Twitter API


Mortekai

Recommended Posts

I have built a small database which use the Twitter API to extract data from the listed members XML files (http://twitter.com/users/show.xml?screen_name=username) and it works well, but since the database makes several calls everytime a page loads I get kicked out very quickly, even with a small memberbase. So I wonder what solution would help with this problem?

 

I have considered dropping the XML data into the database and saving each XML file on the server, but I am not sure what solution would be best?

Link to comment
https://forums.phpfreaks.com/topic/231719-cache-xml-files-twitter-api/
Share on other sites

Parsing XML is slow compared to a database SELECT.

 

Set up your DB tables so that it represents the XML schema. Pull the XML file in, parse it, and save the relevant information in it to the database. That way every time you want to reference that data, your not parsing an XML file (which takes time).

 

If your wanting to delete the old data, when you pull another/updated feed in, just do a DELETE where the timestamp is less than the current timestamp.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.