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

Node.js 我已经更新了github上的数据,但是节点模块请求仍然得到旧数据,node.js,caching,request,Node.js,Caching,Request,我在github上放了一些数据。 我使用节点模块“请求”从中获取数据。 在我在github上更新数据之后。 nodej仍然会在大约五分钟内获取旧数据。 这是我代码的一部分。 var url = "https://raw.githubusercontent.com/Larry850806/facebook-chat-bot/master/db.json"; request({ url: url, json: true }, function(error, response, body){

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

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
    }
});
我想这是因为有一个缓存。
因此,我无法获取“真实”数据,只能获取旧数据。

有没有办法获取最新数据?

确实有一个Github缓存。您可能希望尝试的一件事是在请求的文件末尾附加一个随机查询字符串

例如:

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
    }
});
var url=”https://raw.githubusercontent.com/Larry850806/facebook-chat-bot/master/db.json?random=";
请求({url:url,json:true},函数(错误,响应,正文){
如果(!error&&response.statusCode==200){
console.log(body);//打印json响应
//在我更新数据之后,body仍然会得到旧数据
}
});
这有时会“强制”后端服务器断开缓存(如果他们正在查找查询字符串)