Adds a negative entry to the Cache. @param name The name of the negative entry @param type The type of the negative entry @param soa The SOA record to add to the negative cache entry, or null. The negative cache ttl is derived from the SOA. @param cred The credibility of the negative entry
(Name name, int type, SOARecord soa, int cred)
| 379 | * @param cred The credibility of the negative entry |
| 380 | */ |
| 381 | public synchronized void |
| 382 | addNegative(Name name, int type, SOARecord soa, int cred) { |
| 383 | long ttl = 0; |
| 384 | if (soa != null) |
| 385 | ttl = soa.getTTL(); |
| 386 | Element element = findElement(name, type, 0); |
| 387 | if (ttl == 0) { |
| 388 | if (element != null && element.compareCredibility(cred) <= 0) |
| 389 | removeElement(name, type); |
| 390 | } else { |
| 391 | if (element != null && element.compareCredibility(cred) <= 0) |
| 392 | element = null; |
| 393 | if (element == null) |
| 394 | addElement(name, new NegativeElement(name, type, |
| 395 | soa, cred, |
| 396 | maxncache)); |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | /** |
| 401 | * Finds all matching sets or something that causes the lookup to stop. |
no test coverage detected