Refine search
private DnsCache newCache() { return new DefaultDnsCache(intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE), intValue(negativeTtl, 0)); }
@Override public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals) { checkNotNull(hostname, "hostname"); if (!emptyAdditionals(additionals)) { return Collections.<DnsCacheEntry>emptyList(); } return resolveCache.get(appendDot(hostname)); }
private void cache0(DefaultDnsCacheEntry e, int ttl, EventLoop loop) { Entries entries = resolveCache.get(e.hostname()); if (entries == null) { entries = new Entries(e); Entries oldEntries = resolveCache.putIfAbsent(e.hostname(), entries); if (oldEntries != null) { entries = oldEntries; } } entries.add(e); scheduleCacheExpiration(e, ttl, loop); }
@Override public List<DnsCacheEntry> get(String hostname, DnsRecord[] additionals) { checkNotNull(hostname, "hostname"); if (!emptyAdditionals(additionals)) { return null; } return resolveCache.get(hostname); }
@Override public boolean clear(String hostname) { checkNotNull(hostname, "hostname"); return resolveCache.clear(appendDot(hostname)); }
@Override public void cache(String hostname, DnsRecord[] additionals, Throwable cause, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(cause, "cause"); checkNotNull(loop, "loop"); if (negativeTtl == 0 || !emptyAdditionals(additionals)) { return; } final List<DnsCacheEntry> entries = cachedEntries(hostname); final DnsCacheEntry e = new DnsCacheEntry(hostname, cause); synchronized (entries) { final int numEntries = entries.size(); for (int i = 0; i < numEntries; i ++) { entries.get(i).cancelExpiration(); } entries.clear(); entries.add(e); } scheduleCacheExpiration(entries, e, negativeTtl, loop); }
@Override public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, Throwable cause, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(cause, "cause"); checkNotNull(loop, "loop"); final DefaultDnsCacheEntry e = new DefaultDnsCacheEntry(hostname, cause); if (negativeTtl == 0 || !emptyAdditionals(additionals)) { return e; } cache0(e, Math.min(MAX_SUPPORTED_TTL_SECS, negativeTtl), loop); return e; }
@Override public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals) { checkNotNull(hostname, "hostname"); if (!emptyAdditionals(additionals)) { return Collections.<DnsCacheEntry>emptyList(); } Entries entries = resolveCache.get(hostname); return entries == null ? null : entries.get(); }
@Override public boolean clear(String hostname) { checkNotNull(hostname, "hostname"); return resolveCache.clear(appendDot(hostname)); }
@Override public void cache(String hostname, DnsRecord[] additionals, InetAddress address, long originalTtl, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(address, "address"); checkNotNull(loop, "loop"); if (maxTtl == 0 || !emptyAdditionals(additionals)) { return; } final int ttl = Math.max(minTtl, (int) Math.min(maxTtl, originalTtl)); final List<DnsCacheEntry> entries = cachedEntries(hostname); final DnsCacheEntry e = new DnsCacheEntry(hostname, address); synchronized (entries) { if (!entries.isEmpty()) { final DnsCacheEntry firstEntry = entries.get(0); if (firstEntry.cause() != null) { assert entries.size() == 1; firstEntry.cancelExpiration(); entries.clear(); } } entries.add(e); } scheduleCacheExpiration(entries, e, ttl, loop); }
@Override public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, InetAddress address, long originalTtl, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(address, "address"); checkNotNull(loop, "loop"); final DefaultDnsCacheEntry e = new DefaultDnsCacheEntry(hostname, address); if (maxTtl == 0 || !emptyAdditionals(additionals)) { return e; } cache0(e, Math.max(minTtl, Math.min(MAX_SUPPORTED_TTL_SECS, (int) Math.min(maxTtl, originalTtl))), loop); return e; }
@Override public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals) { checkNotNull(hostname, "hostname"); if (!emptyAdditionals(additionals)) { return Collections.<DnsCacheEntry>emptyList(); } return resolveCache.get(appendDot(hostname)); }
@Override public boolean clear(String hostname) { checkNotNull(hostname, "hostname"); return resolveCache.clear(appendDot(hostname)); }
private DnsCache newCache() { return new DefaultDnsCache(intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE), intValue(negativeTtl, 0)); }
@Override public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, Throwable cause, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(cause, "cause"); checkNotNull(loop, "loop"); DefaultDnsCacheEntry e = new DefaultDnsCacheEntry(hostname, cause); if (negativeTtl == 0 || !emptyAdditionals(additionals)) { return e; } resolveCache.cache(appendDot(hostname), e, negativeTtl, loop); return e; }
int minTtl = intValue(options.getCacheMinTimeToLive(), 0); int maxTtl = intValue(options.getCacheMaxTimeToLive(), Integer.MAX_VALUE); int negativeTtl = intValue(options.getCacheNegativeTimeToLive(), 0); DnsCache resolveCache = new DefaultDnsCache(minTtl, maxTtl, negativeTtl); DnsCache authoritativeDnsServerCache = new DefaultDnsCache(minTtl, maxTtl, negativeTtl);
@Override public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, InetAddress address, long originalTtl, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(address, "address"); checkNotNull(loop, "loop"); DefaultDnsCacheEntry e = new DefaultDnsCacheEntry(hostname, address); if (maxTtl == 0 || !emptyAdditionals(additionals)) { return e; } resolveCache.cache(appendDot(hostname), e, Math.max(minTtl, (int) Math.min(maxTtl, originalTtl)), loop); return e; }
int minTtl = intValue(options.getCacheMinTimeToLive(), 0); int maxTtl = intValue(options.getCacheMaxTimeToLive(), Integer.MAX_VALUE); int negativeTtl = intValue(options.getCacheNegativeTimeToLive(), 0); DnsCache resolveCache = new DefaultDnsCache(minTtl, maxTtl, negativeTtl); DnsCache authoritativeDnsServerCache = new DefaultDnsCache(minTtl, maxTtl, negativeTtl);
@Override public DnsCacheEntry cache(String hostname, DnsRecord[] additionals, InetAddress address, long originalTtl, EventLoop loop) { checkNotNull(hostname, "hostname"); checkNotNull(address, "address"); checkNotNull(loop, "loop"); DefaultDnsCacheEntry e = new DefaultDnsCacheEntry(hostname, address); if (maxTtl == 0 || !emptyAdditionals(additionals)) { return e; } resolveCache.cache(appendDot(hostname), e, Math.max(minTtl, (int) Math.min(maxTtl, originalTtl)), loop); return e; }
private DnsCache newCache() { return new DefaultDnsCache(intValue(minTtl, 0), intValue(maxTtl, Integer.MAX_VALUE), intValue(negativeTtl, 0)); }