axios-cached-dns-resolve
axios-cached-dns-resolve copied to clipboard
Reasoning behind 100 cache size default
I noticed the default cache size is 100. What's the rationale there? Shouldn't this be able to potentially hold thousands of entries without any notable impact on memory?
https://github.com/tcollinsworth/axios-cached-dns-resolve/blob/e5d90cf3e024f80e3e19a9e6a5555653f9000898/axios-cached-dns-resolve.js#L19
Separately, I'd like an ability to know whenever a cache eviction happens due to the cache filling up
I'm bringing up this issue because I am seeing a weird error where the refresh metric is always zero. Somehow refresh is never happening and I'm trying to determine if it's due to the cache having over 100 entries or maybe somehow the entry get evicted before the refresh code runs.
I set it based on typical needs of the many dozens of microservices I've worked with recently. They typically only communicate with a dozen or so services. It is configurable so if you need more, you can change it.
As for an eviction event, that seems like a reasonable request. Do you want to create a PR?
Yes I'll send a PR within the week
So I came to an unfortunate conclusion behind why they refresh metric was 0.
When I set process.env.AXIOS_DNS_CACHE_TTL_MS
then this code doesn't run.
So instead of a PR for adding cache eviction events I'll instead be looking for where this bug is
For context, I set it to 30 seconds (process.env.AXIOS_DNS_CACHE_TTL_MS = 30 * 1000;
)