Package org.xbill.DNS.dnssec
Class KeyCache
java.lang.Object
org.xbill.DNS.dnssec.KeyCache
Cache for DNSKEY RRsets or corresponding null/bad key entries with a limited size and respect for
TTL values.
- Since:
- 3.5
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classUtility class to cache key entries with an expiration date. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<String, KeyCache.CacheEntry> This is the main caching data structure.private final Clockprivate static final intprivate static final intstatic final StringName of the property that configures the maximum cache size.static final StringName of the property that configures the maximum cache TTL.private intThis is the maximum number of entries that the key cache will hold.private longThis is the maximum TTL [s] that all key cache entries will have. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFind the 'closest' trusted DNSKEY rrset to the given name.voidinit(Properties config) Initialize the cache.private Stringprivate KeyEntrylookupEntry(String key) voidStore aKeyEntryin the cache.
-
Field Details
-
MAX_TTL_CONFIG
Name of the property that configures the maximum cache TTL.- See Also:
-
MAX_CACHE_SIZE_CONFIG
Name of the property that configures the maximum cache size.- See Also:
-
DEFAULT_MAX_TTL
private static final int DEFAULT_MAX_TTL- See Also:
-
DEFAULT_MAX_CACHE_SIZE
private static final int DEFAULT_MAX_CACHE_SIZE- See Also:
-
cache
This is the main caching data structure. -
clock
-
maxTtl
private long maxTtlThis is the maximum TTL [s] that all key cache entries will have. -
maxCacheSize
private int maxCacheSizeThis is the maximum number of entries that the key cache will hold.
-
-
Constructor Details
-
KeyCache
public KeyCache()Creates a new instance of this class. Uses the default system clock for cache eviction. -
KeyCache
Creates a new instance of this class.- Parameters:
clock- The clock to use for cache eviction.
-
-
Method Details
-
init
Initialize the cache. This implementation recognizes the following configuration parameters:- "dnsjava.dnssec.keycache.max_ttl"
- The maximum TTL to apply to any cache entry.
- "dnsjava.dnssec.keycache.max_size"
- The maximum number of entries that the cache will hold.
- Parameters:
config- The configuration information.
-
find
Find the 'closest' trusted DNSKEY rrset to the given name.- Parameters:
n- The name to start the search.dclass- The class this DNSKEY rrset should be in.- Returns:
- The 'closest' entry to 'n' in the same class as 'dclass'.
-
store
Store aKeyEntryin the cache. The entry will be ignored if it isn't a DNSKEY rrset, if it doesn't have the SECURE security status, or if it isn't a null-Key.- Parameters:
ke- The key entry to cache.
-
key
-
lookupEntry
-