Skip to content

Commit

Permalink
Fix LRUCache
Browse files Browse the repository at this point in the history
  • Loading branch information
mar-v-in committed Aug 19, 2015
1 parent 66ae2a9 commit 5fff0fa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion minidns-core/src/main/java/de/measite/minidns/LRUCache.java
Expand Up @@ -99,7 +99,7 @@ public synchronized DNSMessage get(Question q) {
for (Record r : message.getAdditionalResourceRecords()) {
ttl = Math.min(ttl, r.ttl);
}
if (message.getReceiveTimestamp() + ttl > System.currentTimeMillis()) {
if (message.getReceiveTimestamp() + ttl < System.currentTimeMillis()) {
missCount++;
expireCount++;
backend.remove(q);
Expand Down Expand Up @@ -146,4 +146,8 @@ public long getHitCount() {
return hitCount;
}

@Override
public String toString() {
return "LRUCache{usage=" + backend.size() + "/" + capacity + ", hits=" + hitCount + ", misses=" + missCount + ", expires=" + expireCount + "}";
}
}

0 comments on commit 5fff0fa

Please sign in to comment.