Class KeyCache

java.lang.Object
org.xbill.DNS.dnssec.KeyCache

final class KeyCache extends Object
Cache for DNSKEY RRsets or corresponding null/bad key entries with a limited size and respect for TTL values.
Since:
3.5
  • Field Details

    • MAX_TTL_CONFIG

      public static final String MAX_TTL_CONFIG
      Name of the property that configures the maximum cache TTL.
      See Also:
    • MAX_CACHE_SIZE_CONFIG

      public static final String 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

      private final Map<String,KeyCache.CacheEntry> cache
      This is the main caching data structure.
    • clock

      private final Clock clock
    • maxTtl

      private long maxTtl
      This is the maximum TTL [s] that all key cache entries will have.
    • maxCacheSize

      private int maxCacheSize
      This 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

      public KeyCache(Clock clock)
      Creates a new instance of this class.
      Parameters:
      clock - The clock to use for cache eviction.
  • Method Details

    • init

      public void init(Properties config)
      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

      public KeyEntry find(Name n, int dclass)
      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

      public void store(KeyEntry ke)
      Store a KeyEntry in 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

      private String key(Name n, int dclass)
    • lookupEntry

      private KeyEntry lookupEntry(String key)