From Good-Tutorials: PHP –Use ajax to create a cacheing system:
This is a class that extracts the rss data from vi.sualize.us servers and gets the images to display them. I do this every time someone visits the page. If any image is new for the first time we display the image from vi.sualize.us and run a functions in javascript to check for new images. If any new images exist then we cache them in a folder on our server and the next time a user visits the page that image will be shown from our server.