Example usage for org.apache.http.impl.client.cache CacheConfig setSharedCache

List of usage examples for org.apache.http.impl.client.cache CacheConfig setSharedCache

Introduction

In this page you can find the example usage for org.apache.http.impl.client.cache CacheConfig setSharedCache.

Prototype

public void setSharedCache(boolean isSharedCache) 

Source Link

Document

Sets whether the cache should behave as a shared cache or not.

Usage

From source file:fr.ippon.wip.http.hc.HttpClientResourceManager.java

private CacheConfig createAndConfigureCache() {
    CacheConfig cacheConfig = new CacheConfig();
    cacheConfig.setSharedCache(false);
    cacheConfig.setHeuristicCachingEnabled(true);
    cacheConfig.setHeuristicCoefficient((float) heuristicCacheRatio);
    cacheConfig.setHeuristicDefaultLifetime(60);
    cacheConfig.setMaxObjectSize(4000000);

    return cacheConfig;
}

From source file:org.obiba.opal.rest.client.magma.OpalJavaClient.java

private HttpClient enableCaching(HttpClient httpClient) {
    CacheConfig config = new CacheConfig();
    config.setSharedCache(false);
    config.setMaxObjectSizeBytes(MAX_OBJECT_SIZE_BYTES);
    cacheFolder = Files.createTempDir();
    return new CachingHttpClient(httpClient, new FileResourceFactory(cacheFolder),
            cacheStorage = new ManagedHttpCacheStorage(config), config);
}