protected Cache createCache() { return new Cache(); }
@After public void after() { Lookup.setDefaultCache(new Cache(), DClass.IN); }
/** * Sets the cache to use when performing this lookup. This overrides the * default value. If the results of this lookup should not be permanently * cached, null can be provided here. * @param cache The cache to use. */ public void setCache(Cache cache) { if (cache == null) { this.cache = new Cache(dclass); this.temporary_cache = true; } else { this.cache = cache; this.temporary_cache = false; } }
/** * Sets the cache to use when performing this lookup. This overrides the * default value. If the results of this lookup should not be permanently * cached, null can be provided here. * @param cache The cache to use. */ public void setCache(Cache cache) { if (cache == null) { this.cache = new Cache(dclass); this.temporary_cache = true; } else { this.cache = cache; this.temporary_cache = false; } }
/** * Sets the cache to use when performing this lookup. This overrides the * default value. If the results of this lookup should not be permanently * cached, null can be provided here. * @param cache The cache to use. */ public void setCache(Cache cache) { if (cache == null) { this.cache = new Cache(dclass); this.temporary_cache = true; } else { this.cache = cache; this.temporary_cache = false; } }
/** * Sets the cache to use when performing this lookup. This overrides the * default value. If the results of this lookup should not be permanently * cached, null can be provided here. * @param cache The cache to use. */ public void setCache(Cache cache) { if (cache == null) { this.cache = new Cache(dclass); this.temporary_cache = true; } else { this.cache = cache; this.temporary_cache = false; } }
@Test public void testCache() throws UnknownHostException { final Cache cache = new Cache() { @Override public SetResponse lookupRecords(Name name, int type, int minCred) { final SetResponse setResponse = super.lookupRecords(name, type, minCred); if (count++ == 0) { assertThat(setResponse.isUnknown(), is(true)); } else { assertThat(setResponse.isUnknown(), is(false)); } return setResponse; //To change body of overridden methods use File | Settings | File Templates. } }; LocalManagedDnsImpl impl = new LocalManagedDnsImpl() { @Override protected Cache createCache() { return cache; } }; assertThat(impl.lookupAllHostAddr("www.google.com"), notNullValue()); assertThat(impl.lookupAllHostAddr("www.google.com"), notNullValue()); assertThat(impl.lookupAllHostAddr("www.google.com"), notNullValue()); assertThat(impl.lookupAllHostAddr("www.google.com"), notNullValue()); assertThat(impl.lookupAllHostAddr("www.google.com"), notNullValue()); }
public Cache getCache(int dclass) { Cache c = _caches.get(dclass); if (c == null) { c = new Cache(dclass); _caches.put(dclass, c); } return c; }
public Cache getCache(final int dclass) { Cache c = m_caches.get(dclass); if (c == null) { c = new Cache(dclass); m_caches.put(Integer.valueOf(dclass), c); } return c; }
public Cache getCache(int dclass) { Cache c = (Cache) caches.get(new Integer(dclass)); if (c == null) { c = new Cache(dclass); caches.put(new Integer(dclass), c); } return c; }
/** * Gets the Cache that will be used as the default for the specified * class by future Lookups. * @param dclass The class whose cache is being retrieved. * @return The default cache for the specified class. */ public static synchronized Cache getDefaultCache(int dclass) { DClass.check(dclass); Cache c = (Cache) defaultCaches.get(Mnemonic.toInteger(dclass)); if (c == null) { c = new Cache(dclass); defaultCaches.put(Mnemonic.toInteger(dclass), c); } return c; }
addSecondaryZone(st.nextToken(), st.nextToken()); } else if (keyword.equals("cache")) { final Cache cache = new Cache(st.nextToken()); _caches.put(DClass.IN, cache); } else if (keyword.equals("key")) {
public DNSCacheManager() { setProperty(new CollectionProperty(SERVERS, new ArrayList<String>())); this.systemDefaultDnsResolver = new SystemDefaultDnsResolver(); this.cache = new LinkedHashMap<>(); //disabling cache lookupCache = new Cache(); lookupCache.setMaxCache(0); lookupCache.setMaxEntries(0); }
/** * Gets the Cache that will be used as the default for the specified * class by future Lookups. * @param dclass The class whose cache is being retrieved. * @return The default cache for the specified class. */ public static synchronized Cache getDefaultCache(int dclass) { DClass.check(dclass); Cache c = (Cache) defaultCaches.get(Mnemonic.toInteger(dclass)); if (c == null) { c = new Cache(dclass); defaultCaches.put(Mnemonic.toInteger(dclass), c); } return c; }
/** * Gets the Cache that will be used as the default for the specified * class by future Lookups. * @param dclass The class whose cache is being retrieved. * @return The default cache for the specified class. */ public static synchronized Cache getDefaultCache(int dclass) { DClass.check(dclass); Cache c = (Cache) defaultCaches.get(Mnemonic.toInteger(dclass)); if (c == null) { c = new Cache(dclass); defaultCaches.put(Mnemonic.toInteger(dclass), c); } return c; }
/** * Gets the Cache that will be used as the default for the specified * class by future Lookups. * @param dclass The class whose cache is being retrieved. * @return The default cache for the specified class. */ public static synchronized Cache getDefaultCache(int dclass) { DClass.check(dclass); Cache c = (Cache) defaultCaches.get(Mnemonic.toInteger(dclass)); if (c == null) { c = new Cache(dclass); defaultCaches.put(Mnemonic.toInteger(dclass), c); } return c; }
addSecondaryZone(st.nextToken(), st.nextToken()); } else if (keyword.equals("cache")) { final Cache cache = new Cache(st.nextToken()); m_caches.put(Integer.valueOf(DClass.IN), cache); } else if (keyword.equals("key")) {
st.nextToken()); else if (keyword.equals("cache")) { Cache cache = new Cache(st.nextToken()); caches.put(new Integer(DClass.IN), cache); } else if (keyword.equals("key")) {
cache = new Cache(DClass.IN); cache.setMaxEntries(maxCacheSize); cache.setMaxNCache(negativeCacheTTL);
cache = new Cache(DClass.IN); cache.setMaxEntries(maxCacheSize); cache.setMaxNCache(negativeCacheTTL);