Modifier and Type | Field and Description |
---|---|
protected LinkedHashMap<Question,DNSMessage> |
backend
The backend cache.
|
protected int |
capacity
The internal capacity of the backend cache.
|
protected long |
expireCount
Internal expire count (subset of misses that was caused by expire).
|
protected long |
hitCount
Internal hit count.
|
protected long |
maxTTL
The upper bound of the ttl.
|
protected long |
missCount
Internal miss count.
|
Constructor and Description |
---|
LRUCache(int capacity)
Create a new LRUCache with given capacity.
|
LRUCache(int capacity,
long maxTTL)
Create a new LRUCache with given capacity and upper bound ttl.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear all entries in this cache.
|
DNSMessage |
get(Question q)
Request a cached dns response.
|
long |
getExpireCount()
The number of expires (cache hits that have had a ttl to low to be
retrieved).
|
long |
getHitCount()
The cache hit count (all sucessful calls to get).
|
long |
getMissCount()
Get the miss count of this cache which is the number of fruitless
get calls since this cache was last resetted.
|
void |
put(Question q,
DNSMessage message)
Add an an dns answer/response for a given dns question.
|
protected long missCount
protected long expireCount
protected long hitCount
protected int capacity
protected long maxTTL
protected LinkedHashMap<Question,DNSMessage> backend
public LRUCache(int capacity, long maxTTL)
capacity
- The internal capacity.maxTTL
- The upper bound for any ttl.public LRUCache(int capacity)
capacity
- The capacity of this cache.public void put(Question q, DNSMessage message)
DNSCache
public DNSMessage get(Question q)
DNSCache
public void clear()
public long getMissCount()
public long getExpireCount()
public long getHitCount()
Copyright © 2014–2020. All rights reserved.