/** * Return true if response status code indicates an error. * <p> * If etag cache is enabled, no error on 200 OK and 304 NOT-MODIFIED. * Otherwise, no error only on 200 OK. * * @param status The Status object that contains status code to be checked * * @return true if the status code indicates an error */ protected boolean hasError(Status status) { return CacheFeatureFlag.ETAG.isOn() ? status != Status.OK && status != Status.NOT_MODIFIED : status != Status.OK; }
/** * Because these fields share a common value when that value is updated, clear all the cached values. */ protected static void resetAll() { for (CacheFeatureFlag featureFlag: CacheFeatureFlag.values()) { SYSTEM_CONFIG.clearProperty(SYSTEM_CONFIG.getPackageVariableName("query_response_caching_strategy")); featureFlag.on = null; } }
@Override public void setOn(Boolean newValue) { LOG.warn("setOn(Boolean) method does not apply in CacheFeatureFlag"); on = null; isOn(); }
/** * Build a cache for data requests and matching responses. * * @return The cache instance */ protected DataCache<?> buildCache() { if (CacheFeatureFlag.LOCAL_SIGNATURE.isOn()) { return buildLocalSignatureCache(); } else if (CacheFeatureFlag.TTL.isOn()) { return buildTtlCache(); } else if (CacheFeatureFlag.ETAG.isOn()) { return buildETagCahe(); } else { // not used, but Jersey required a binding return new StubDataCache<>(); } }
mappingJsonFactory.createParser(String.valueOf(statusCode)).readValueAsTree() ); if (CacheFeatureFlag.ETAG.isOn() && statusCode == OK.getStatusCode()) { objectNode.set( DruidJsonResponseContentKeys.ETAG.getName(),
if (CacheFeatureFlag.TTL.isOn()) { handler = new CacheRequestHandler(handler, dataCache, mapper); } else if (CacheFeatureFlag.LOCAL_SIGNATURE.isOn()) { handler = new CacheV2RequestHandler(handler, dataCache, querySigningService, mapper); } else if (CacheFeatureFlag.ETAG.isOn()) { handler = new EtagCacheRequestHandler( handler,
if (CacheFeatureFlag.TTL.isOn()) { handler = new CacheRequestHandler(handler, dataCache, mapper); } else if (CacheFeatureFlag.LOCAL_SIGNATURE.isOn()) { handler = new CacheV2RequestHandler(handler, dataCache, querySigningService, mapper); } else if (CacheFeatureFlag.ETAG.isOn()) { handler = new EtagCacheRequestHandler( handler,