blocky do not cache nxdomain

Hi ๐Ÿ‘‹๐Ÿผ

It would be cool if this could be default, or configurable. Usually I'm testing things in my homelab and my service isn't online just yet when I try to hit it. Blocky caches that nxdomain so I always need to bounce the container to clear the cache.

Thanks!

Asked Jan 11 '22 11:01
avatar onedr0p
onedr0p

3 Answer:

Hi,

I think, it makes sense to cache negative results. The default TTL is 30 min (https://github.com/0xERR0R/blocky/blob/97a4a2eff34c5173410aada6c46c2cebff2616ad/resolver/caching_resolver.go#L35). Making it configurable is a good idea ๐Ÿ‘

1
Answered Sep 21 '21 at 05:36
avatar  of 0xERR0R
0xERR0R

Would setting this to -1 or 0 allow for me to disable caching of "negative" results?

1
Answered Sep 21 '21 at 11:41
avatar  of onedr0p
onedr0p

Do you mean, if you change the code? No, it must be positive (see comment of the caching library: https://github.com/0xERR0R/go-cache/blob/58f35d51010e75d5b0d8963a21d6053a10d0791d/cache.go#L55). As quickfix you can set it to 1ns.

I would change the logic, if configured negativeCacheTime is <=0 - don't cache negative result. If positive, use it as cache time. I would also reduce the default value from 30m to something smaller (5m or maybe 1m).

1
Answered Sep 21 '21 at 13:00
avatar  of 0xERR0R
0xERR0R