I want to remove the cache value of ip
address for every 10sec of TTL
value. The following is my code,
// İSTEMCİNİN '/' İSTEĞİNE KARŞILIK VEREN KOD BLOĞU
app.get('/getIpAdress/:url', function (req, res) {
dns.resolve4(req.params.url, { 'ttl': true }, (err, address, family) => {
if (err) {
let obj = {
ip: '',
statusCode: 1,
resp: 'Ip address not found',
timeStamp: new Date()
}
res.status(200).json(obj);
return;
};
sendResponse(address, res);
});
function sendResponse(address, res) {
let obj = {
url: req.params.url,
ip: address,
resp: 'Ip address found',
statusCode: 0,
timeStamp: new Date()
}
res.status(200).json(obj);
}
});
}
The above code returns ip
and ttl
but i want the ip
to be changed for every 10 secs.
New contributor
user23959239 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.