开发者

Facebook API - cache response on server

开发者 https://www.devze.com 2023-03-22 07:31 出处:网络
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

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开发者_StackOverflow中文版 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消