use of org.minidns.DNSCache in project minidns by MiniDNS.
the class DNSDataSource method cacheResult.
protected final void cacheResult(DNSMessage request, DNSMessage response) {
final DNSCache activeCache = cache;
if (activeCache == null) {
return;
}
activeCache.put(request, response);
}
use of org.minidns.DNSCache in project minidns by MiniDNS.
the class IntegrationTestTools method getClient.
public static DNSSECClient getClient(CacheConfig cacheConfig) {
DNSCache cache;
switch(cacheConfig) {
case without:
cache = null;
break;
case normal:
cache = new LRUCache();
break;
case extended:
cache = new ExtendedLRUCache();
break;
case full:
cache = new FullLRUCache();
break;
default:
throw new IllegalStateException();
}
DNSSECClient client = new DNSSECClient(cache);
client.setDataSource(new NetworkDataSourceWithAccounting());
return client;
}
use of org.minidns.DNSCache in project minidns by MiniDNS.
the class MiniDNSStats method getStats.
public static StringBuilder getStats(AbstractDNSClient client) {
StringBuilder sb = new StringBuilder();
NetworkDataSourceWithAccounting ndswa = NetworkDataSourceWithAccounting.from(client);
if (ndswa != null) {
sb.append(ndswa.getStats().toString());
} else {
sb.append("Client is not using " + NetworkDataSourceWithAccounting.class.getSimpleName());
}
DNSCache dnsCache = client.getCache();
if (dnsCache != null) {
sb.append(dnsCache);
} else {
sb.append("Client is not using a Cache");
}
return sb;
}
Aggregations