I am calling Facebook API to retrieve my fan page’s like count on my WordPress blog. It is working fine (I retrieved the XML and parsed it with file_get_contents.) Now the problem is that the API is called at every page load and to also file_get_contents() is rather slow a method. I want to call the API only once per hour and keep the data in cache to reduce load times.
I don’t know hot to go about it? Is that even possible? Help.
It’s a little low-tech but storing the “likes” with a timestamp in a text file should do the trick. Something like this should work (PHP5):