我已经更新了github上的数据,但节点模块请求仍然得到旧数据

我把一些数据放在github上。
我使用节点模块“请求”从中获取数据。
我在github上更新数据后。
nodejs仍旧得到大约五分钟的旧数据。
这是我的代码的一部分。

var url = "https://raw.githubusercontent.com/Larry850806/facebook-chat-bot/master/db.json"; request({ url: url, json: true }, function(error, response, body){ if (!error && response.statusCode === 200) { console.log(body); // Print the json response // after I update data, body still get old data } }); 

我想这是因为有一个caching。
所以我不能得到“真实”的数据,而是旧的数据。
有没有办法获得最新的数据?

确实有一个Githubcaching。 你可能想要尝试的一件事是将一个随机的查询string追加到你请求的文件的末尾。

例如:

 var url = "https://raw.githubusercontent.com/Larry850806/facebook-chat-bot/master/db.json?random=<randomnumberhere>"; request({ url: url, json: true }, function(error, response, body){ if (!error && response.statusCode === 200) { console.log(body); // Print the json response // after I update data, body still get old data } }); 

这有时会“强制”后端服务器中断caching(如果他们正在寻找querystrings)。