public BasicHttpCache() { this(new CacheConfig()); }
public CacheConfig build() { return new CacheConfig( maxObjectSize, maxCacheEntries, maxUpdateRetries, allow303Caching, weakETagOnPutDeleteAllowed, heuristicCachingEnabled, heuristicCoefficient, heuristicDefaultLifetime, isSharedCache, asynchronousWorkersMax, asynchronousWorkersCore, asynchronousWorkerIdleLifetimeSecs, revalidationQueueSize, neverCacheHTTP10ResponsesWithQuery); }
public EtagCachingHttpClient(HttpClient httpClient) { this(httpClient, new BasicHttpCacheStorage(new CacheConfig())); }
public EtagCachingHttpClient() { this(new DefaultHttpClient(), new BasicHttpCacheStorage(new CacheConfig())); }
/** * Constructs a storage backend using the provided Ehcache * with default configuration options. * @param cache where to store cached origin responses */ public EhcacheHttpCacheStorage(Ehcache cache) { this(cache, new CacheConfig(), new DefaultHttpCacheEntrySerializer()); }
/** * Constructs a {@code CachingHttpClient} with default caching settings that * stores cache entries in memory and uses the given {@link HttpClient} * for backend requests. * @param client used to make origin requests */ public CachingHttpClient(HttpClient client) { this(client, new BasicHttpCache(), new CacheConfig()); }
/** * Constructs a {@code CachingHttpClient} with default caching settings that * stores cache entries in memory and uses a vanilla {@link DefaultHttpClient} * for backend requests. */ public CachingHttpClient() { this(new DefaultHttpClient(), new BasicHttpCache(), new CacheConfig()); }
/** * Constructs a {@code CachingHttpClient} with default caching settings that * stores cache entries in memory and uses a vanilla {@link DefaultHttpClient} * for backend requests. */ public CachingHttpClient() { this(new DefaultHttpClient(), new BasicHttpCache(), new CacheConfig()); }
/** * Constructs a {@code CachingHttpClient} with default caching settings that * stores cache entries in memory and uses the given {@link HttpClient} * for backend requests. * @param client used to make origin requests */ public CachingHttpClient(final HttpClient client) { this(client, new BasicHttpCache(), new CacheConfig()); }
private HttpCacheStorage createStorage() { CacheConfig config = new CacheConfig(); // if max cache entries value is not present the CacheConfig's default (CacheConfig.DEFAULT_MAX_CACHE_ENTRIES = 1000) will be used Integer maxCacheEntries = Integer.getInteger("bitbucket.client.cache.maxentries"); if (maxCacheEntries != null) { config.setMaxCacheEntries(maxCacheEntries); } return new BasicHttpCacheStorage(config); }
/** * Create a storage backend using the pre-configured given * <i>memcached</i> client. * @param cache client to use for communicating with <i>memcached</i> */ public MemcachedHttpCacheStorage(MemcachedClientIF cache) { this(cache, new CacheConfig(), new MemcachedCacheEntryFactoryImpl(), new SHA256KeyHashingScheme()); }
public static org.apache.http.client.HttpClient withCaching(org.apache.http.client.HttpClient client, int maxCacheEntries, int maxObjectSizeBytes) { CacheConfig cacheConfig = new CacheConfig(); cacheConfig.setMaxCacheEntries(maxCacheEntries); cacheConfig.setMaxObjectSize(maxObjectSizeBytes); return new CachingHttpClient(client, cacheConfig); } }
CacheConfig cacheConfig = new CacheConfig(); cacheConfig.setMaxCacheEntries(1000); cacheConfig.setHeuristicCachingEnabled(true);
CacheConfig cacheConfig = new CacheConfig();
CachingHttpClient( HttpClient backend, CacheValidityPolicy validityPolicy, ResponseCachingPolicy responseCachingPolicy, HttpCache responseCache, CachedHttpResponseGenerator responseGenerator, CacheableRequestPolicy cacheableRequestPolicy, CachedResponseSuitabilityChecker suitabilityChecker, ConditionalRequestBuilder conditionalRequestBuilder, ResponseProtocolCompliance responseCompliance, RequestProtocolCompliance requestCompliance) { CacheConfig config = new CacheConfig(); this.maxObjectSizeBytes = config.getMaxObjectSize(); this.sharedCache = config.isSharedCache(); this.backend = backend; this.validityPolicy = validityPolicy; this.responseCachingPolicy = responseCachingPolicy; this.responseCache = responseCache; this.responseGenerator = responseGenerator; this.cacheableRequestPolicy = cacheableRequestPolicy; this.suitabilityChecker = suitabilityChecker; this.conditionalRequestBuilder = conditionalRequestBuilder; this.responseCompliance = responseCompliance; this.requestCompliance = requestCompliance; this.asynchRevalidator = makeAsynchronousValidator(config); }
public void reload() { final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager); if (properties.getBoolean(OutagesProperties.ENABLE_CACHE)) { final CacheConfig config = new CacheConfig(); config.setHeuristicCachingEnabled(true); config.setHeuristicDefaultLifetime(properties.getLong(OutagesProperties.CACHE_TTL)); config.setHeuristicCoefficient(1); config.setMaxCacheEntries(properties.getInt(OutagesProperties.MAX_CACHE_ENTRIES)); config.setMaxObjectSize(properties.getLong(OutagesProperties.MAX_OBJECT_SIZE)); this.client = new CachingHttpClient(httpClient, config); } else { this.client = httpClient; } }
CachingHttpClient( final HttpClient backend, final CacheValidityPolicy validityPolicy, final ResponseCachingPolicy responseCachingPolicy, final HttpCache responseCache, final CachedHttpResponseGenerator responseGenerator, final CacheableRequestPolicy cacheableRequestPolicy, final CachedResponseSuitabilityChecker suitabilityChecker, final ConditionalRequestBuilder conditionalRequestBuilder, final ResponseProtocolCompliance responseCompliance, final RequestProtocolCompliance requestCompliance) { final CacheConfig config = new CacheConfig(); this.maxObjectSizeBytes = config.getMaxObjectSize(); this.sharedCache = config.isSharedCache(); this.backend = backend; this.validityPolicy = validityPolicy; this.responseCachingPolicy = responseCachingPolicy; this.responseCache = responseCache; this.responseGenerator = responseGenerator; this.cacheableRequestPolicy = cacheableRequestPolicy; this.suitabilityChecker = suitabilityChecker; this.conditionalRequestBuilder = conditionalRequestBuilder; this.responseCompliance = responseCompliance; this.requestCompliance = requestCompliance; this.asynchRevalidator = makeAsynchronousValidator(config); }
public void reload() { final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager); if (properties.getBoolean(CseProperties.ENABLE_CACHE)) { final CacheConfig config = new CacheConfig(); config.setHeuristicCachingEnabled(true); config.setHeuristicDefaultLifetime(properties.getLong(CseProperties.CACHE_TTL)); config.setHeuristicCoefficient(1); config.setMaxCacheEntries(properties.getInt(CseProperties.MAX_CACHE_ENTRIES)); config.setMaxObjectSize(properties.getLong(CseProperties.MAX_OBJECT_SIZE)); this.client = new CachingHttpClient(httpClient, config); } else { this.client = httpClient; } }
public void reload() { final DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager); if (properties.getBoolean(HotIssuesProperties.ENABLE_CACHE)) { final CacheConfig config = new CacheConfig(); config.setHeuristicCachingEnabled(true); config.setHeuristicDefaultLifetime(properties.getLong(HotIssuesProperties.CACHE_TTL)); config.setHeuristicCoefficient(1); config.setMaxCacheEntries(properties.getInt(HotIssuesProperties.MAX_CACHE_ENTRIES)); config.setMaxObjectSize(properties.getLong(HotIssuesProperties.MAX_OBJECT_SIZE)); this.client = new CachingHttpClient(httpClient, config); } else { this.client = httpClient; } }
protected static HttpClient getDefaultHttpClient() { final HttpClient result = defaultHttpClient; if (result != null) { return result; } synchronized (DocumentLoader.class) { if (defaultHttpClient == null) { // Uses Apache SystemDefaultHttpClient rather than // DefaultHttpClient, thus the normal proxy settings for the // JVM will be used final DefaultHttpClient client = new SystemDefaultHttpClient(); // Support compressed data // http://hc.apache.org/httpcomponents-client-ga/tutorial/html/httpagent.html#d5e1238 client.addRequestInterceptor(new RequestAcceptEncoding()); client.addResponseInterceptor(new ResponseContentEncoding()); final CacheConfig cacheConfig = new CacheConfig(); cacheConfig.setMaxObjectSize(1024 * 128); // 128 kB cacheConfig.setMaxCacheEntries(1000); // and allow caching final CachingHttpClient cachingClient = new CachingHttpClient(client, cacheConfig); // Wrap again with JAR cache final JarCacheStorage jarCache = new JarCacheStorage(); defaultHttpClient = new CachingHttpClient(cachingClient, jarCache, jarCache.getCacheConfig()); } return defaultHttpClient; } }