|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xbill.DNS.Cache
public class Cache
A cache of DNS records. The cache obeys TTLs, so items are purged after their validity period is complete. Negative answers are cached, to avoid repeated failed DNS queries. The credibility of each RRset is maintained, so that more credible records replace less credible records, and lookups can specify the minimum credibility of data they are requesting.
RRset
,
Credibility
Constructor Summary | |
---|---|
Cache()
Creates an empty Cache for class IN. |
|
Cache(int dclass)
Creates an empty Cache |
|
Cache(String file)
Creates a Cache which initially contains all records in the specified file. |
Method Summary | |
---|---|
SetResponse |
addMessage(Message in)
Adds all data from a Message into the Cache. |
void |
addNegative(Name name,
int type,
SOARecord soa,
int cred)
Adds a negative entry to the Cache. |
void |
addRecord(Record r,
int cred,
Object o)
Adds a record to the Cache. |
void |
addRRset(RRset rrset,
int cred)
Adds an RRset to the Cache. |
void |
clearCache()
Empties the Cache. |
RRset[] |
findAnyRecords(Name name,
int type)
Looks up Records in the Cache (a wrapper around lookupRecords). |
RRset[] |
findRecords(Name name,
int type)
Looks up credible Records in the Cache (a wrapper around lookupRecords). |
void |
flushName(Name name)
Flushes all RRsets with a given name from the cache |
void |
flushSet(Name name,
int type)
Flushes an RRset from the cache |
int |
getDClass()
Returns the DNS class of this cache. |
int |
getMaxCache()
Gets the maximum length of time that records will be stored in this Cache. |
int |
getMaxEntries()
Gets the maximum number of entries in the Cache, where an entry consists of all records with a specific Name. |
int |
getMaxNCache()
Gets the maximum length of time that a negative response will be stored in this Cache. |
int |
getSize()
Gets the current number of entries in the Cache, where an entry consists of all records with a specific Name. |
protected SetResponse |
lookup(Name name,
int type,
int minCred)
Finds all matching sets or something that causes the lookup to stop. |
SetResponse |
lookupRecords(Name name,
int type,
int minCred)
Looks up Records in the Cache. |
void |
setMaxCache(int seconds)
Sets the maximum length of time that records will be stored in this Cache. |
void |
setMaxEntries(int entries)
Sets the maximum number of entries in the Cache, where an entry consists of all records with a specific Name. |
void |
setMaxNCache(int seconds)
Sets the maximum length of time that a negative response will be stored in this Cache. |
String |
toString()
Returns the contents of the Cache as a string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Cache(int dclass)
dclass
- The DNS class of this cacheDClass
public Cache()
DClass
public Cache(String file) throws IOException
IOException
Method Detail |
---|
public void clearCache()
public void addRecord(Record r, int cred, Object o)
r
- The record to be addedcred
- The credibility of the recordo
- The source of the record (this could be a Message, for example)Record
public void addRRset(RRset rrset, int cred)
rrset
- The RRset to be addedcred
- The credibility of these recordsRRset
public void addNegative(Name name, int type, SOARecord soa, int cred)
name
- The name of the negative entrytype
- The type of the negative entrysoa
- The SOA record to add to the negative cache entry, or null.
The negative cache ttl is derived from the SOA.cred
- The credibility of the negative entryprotected SetResponse lookup(Name name, int type, int minCred)
public SetResponse lookupRecords(Name name, int type, int minCred)
name
- The name to look uptype
- The type to look upminCred
- The minimum acceptable credibility
SetResponse
,
Credibility
public RRset[] findRecords(Name name, int type)
name
- The name to look uptype
- The type to look up
Credibility
public RRset[] findAnyRecords(Name name, int type)
name
- The name to look uptype
- The type to look up
Credibility
public SetResponse addMessage(Message in)
in
- The Message to be added
Message
public void flushSet(Name name, int type)
name
- The name of the records to be flushedtype
- The type of the records to be flushedRRset
public void flushName(Name name)
name
- The name of the records to be flushedRRset
public void setMaxNCache(int seconds)
public int getMaxNCache()
public void setMaxCache(int seconds)
public int getMaxCache()
public int getSize()
public int getMaxEntries()
public void setMaxEntries(int entries)
entries
- The maximum number of entries in the Cache.public int getDClass()
public String toString()
toString
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |