Class DnsCacheBuilder

java.lang.Object
com.linecorp.armeria.client.DnsCacheBuilder

@UnstableApi public final class DnsCacheBuilder extends Object
A builder for DnsCache.
  • Method Details

    • cacheSpec

      public DnsCacheBuilder cacheSpec(String cacheSpec)
      Sets the Caffeine specification string. If not specified, Flags.dnsCacheSpec() is used by default.
    • meterRegistry

      public DnsCacheBuilder meterRegistry(MeterRegistry meterRegistry)
      Sets the MeterRegistry that collects cache stats. If unspecified, Metrics.globalRegistry is used.
    • ttl

      public DnsCacheBuilder ttl(int minTtl, int maxTtl)
      Sets the minimum and maximum TTL of the cached DNS resource records in seconds. If the TTL of the DNS resource record returned by the DNS server is less than the minimum TTL or greater than the maximum TTL, this resolver will ignore the TTL from the DNS server and use the minimum TTL or the maximum TTL instead respectively. The default value is 1 and Integer.MAX_VALUE, which practically tells this resolver to respect the TTL from the DNS server.
    • negativeTtl

      public DnsCacheBuilder negativeTtl(int negativeTtl)
      Sets the TTL of the cache for the failed DNS queries in seconds. The default value is 0 which means that failed DNS queries are not cached.
    • build

      public DnsCache build()
      Returns a newly created DnsCache.