問題描述
Facebook API ‑ 在服務器上緩存響應 (Facebook API ‑ cache response on server)
I've got an app/site that makes a few calls out to the Facebook API upon specific user interaction. I was wondering what the best approach is for caching the responses from some of these API calls on the server.
My current setup is node.js running Express and mongoDB for storage. Should I just shove the API response into mongo with a timestamp, and before making future API calls check in there first?
‑‑‑‑‑
參考解法
方法 1:
I'd use something like redis (http://www.redis.io) or memcached (http://memcached.org/) for your caching needs. Make the key a md5 hash of whatever api call you're making and check your cache if the key exists before you hit the api.
(by ghjunior、Jeff Sherlock)