Facebook Graph API缓存

Im working with the facebook graph API from inside CodeIgniter, the only problem is - its so damn slow to work and i was wondering if it would be possible to somehow cache the response from the graph servers on my own webserver somehow?

TO give you an indication of what i mean im making 1 graph API call for each record from the database(getting the number of likes for analytics) in my model, each record from the database is a single page on my site so you can imagine what that does for the performance of my app...

Any help would be appreciated...

Sure it's just like any other cache file. You save the JSON response as a file and check the filemtime() against time(). Only hit the graph API if your cache file is old.

There are many ways to cache data. You could use Redis, Mongo, Memcached, you could store it as a file on disk, you could even write it to a SQL database. Facebook's API Terms of Service prohibit the permanent storage of such data, however, so be wary of that and make sure your cache expires or is temporary in some fashion.