Use YQL to cache your queries
Posted by Shane O'Sullivan on August 5, 2010
When accessing data from remote services, e.g. Flickr, often the data won’t change too frequently. Some data can also be very expensive to generate, and services forbid you from polling it on a regular basis. For example, a device is not allowed to retrieve the latest activity on a users Flickr account more than once per hour.
You could roll your own solution to this problem, store the data locally and check its timestamp. However, this is a lot of work for something that can be so much simpler.
Simply access the XML or JSON data using the Yahoo Query Language, and set the _maxage parameter to the length of time you want to cache the data for. And you’re done. Yahoo will cache the data for you, refresh it when the specified time elapses, and serve it to you faster than the original query since it doesn’t have to calculate anything.
Also, the service provider will be happier as you’re not hitting their server so often for duplicate data.