@UnstableApi
    protected final DnsCache maybeCreateDnsCache() {
        if (needsToCreateDnsCache && dnsCache != DnsCache.ofDefault()) {
            throw new IllegalStateException(
                    "Cannot set dnsCache() with cacheSpec(), ttl(), or negativeTtl().");
        }

        final MeterRegistry meterRegistry = firstNonNull(this.meterRegistry, Flags.meterRegistry());
        if (needsToCreateDnsCache) {
            return DnsCache.builder()
                           .cacheSpec(cacheSpec)
                           .ttl(minTtl, maxTtl)
                           .negativeTtl(negativeTtl)
                           .meterRegistry(meterRegistry)
                           .build();
        } else {
            return dnsCache;
        }
    }
Returns a newly-created {@link DnsCache} if {@link #cacheSpec(String)}, {@link #ttl(int, int)} or
{@link #negativeTtl(int)} is set.
Returns the {@link DnsCache} specified by {@link #dnsCache(DnsCache)} if it is set.
Otherwise, returns the default {@link DnsCache}.
core/src/main/java/com/linecorp/armeria/client/AbstractDnsResolverBuilder.java