Re:Show HN: Get unthrottled access to Amazon product data
by mooreds on Saturday September 14, 2019 @07:14PM
(#20974464)
How do you deal with stale data?
Re:Show HN: Get unthrottled access to Amazon product data
by QueensGambit on Tuesday September 17, 2019 @06:28AM
(#20993459)
I have set the cache expiry to 24 hours. If the cached data is more than 24 hours, it will fetch fresh data from Amazon.
Lets say, user 1 makes an API call to our server to fetch browse node: 1000 (Books). The first time such request is made, our server will make an API call to Amazon using user 1's AWS key. Once we get the response back, we will cache the result and send back the result to user 1. When user 2 makes the request for the same browse node 1000 (Books), we will not hit Amazon server again. Instead, we will get the cached data from our database and send it back to the user 2 without using his/her AWS key. This way the number of API calls made will be less than one per second for a user and avoids the throttling problem.