Facebook API - 在服務器上緩存響應 (Facebook API - cache response on server)


問題描述

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 ghjuniorJeff Sherlock)

參考文件

  1. Facebook API ‑ cache response on server (CC BY‑SA 3.0/4.0)

#caching #mongoDB #Express #node.js #facebook






相關問題

Heroku 上的頁面緩存技巧? (Page caching trick on Heroku?)

Array of Structs selalu lebih cepat daripada Structs of arrays? (Array of Structs are always faster than Structs of arrays?)

使用 Varnish 更改標頭中的引用者 (Change Referrer in header using Varnish)

清理 ios 中的 uiwebview 緩存 (clean uiwebview cache in ios)

緩存整個表 (Caching the entire table)

過期/緩存控制標頭的問題 (Problem with Expires/Cache-Control Headers)

強制 L1 緩存上的一些數據 (force some data on L1 cache)

Facebook API - 在服務器上緩存響應 (Facebook API - cache response on server)

ASIHTTPRequest 離線模式連接失敗 (ASIHTTPRequest offline mode connection failure)

如果小於 X 天,如何從磁盤讀取文件,如果舊,則重新獲取 html 文件 (How to read a file from the disk if less than X days old, if older, refetch the html file)

當您的應用服務器託管在不同的雲服務上時,如何安全地從 Firebase 託管上的 CDN 緩存中受益 (How to safely benefit from CDN caching on Firebase Hosting when your app's server is hosted on a different Cloud service)

如何使用java處理緩存中的鎖定(ConcurrentHashMap) (How to handle lock in cache (ConcurrentHashMap) using java)







留言討論