dnscache icon indicating copy to clipboard operation
dnscache copied to clipboard

Unable to clear cache

Open mirajshah05 opened this issue 8 years ago • 2 comments

Let's say I cache all the results for an hour. What would happen if you get a bad hostname that the library is not able to resolve for a minute but is available later. Would the bad result be cached for an hour? Example: Default config: dnscache = require('dnscache')({ "enable" : true, "ttl" : 3600, "cachesize" : 1000 }); Time 0: Hostname - cannot be resolved dnscache.lookup(hostname ..) => err (would the bad host be cached?) Time 5: Hostname - all up and ready to be resolved dnscache.lookup(hostname ..) => ? (would it pick up from the cache?)

If there is a way you could provide to clean up the cache

If you could add more documentation regarding the use of this library it would be appreciated. Like to return the value we need a callback or a promise based interface. The function is async ..

mirajshah05 avatar Sep 25 '17 22:09 mirajshah05

From my reading of the code, if the lookup failed then nothing will be put into the cache.

drewfish avatar Sep 28 '17 16:09 drewfish

@drewfish @mirajshah05 use https://www.npmjs.com/package/lookup-dns-cache instead it's much more powerful

eduardbme avatar Jan 19 '18 08:01 eduardbme