Package org.apache.http.impl.client.cache

Examples of org.apache.http.impl.client.cache.CacheConfig


    @Override
    @Before
    public void setUp() throws Exception {
        mockMemcachedClient = EasyMock.createMock(MemcachedClientIF.class);
        mockSerializer = EasyMock.createMock(HttpCacheEntrySerializer.class);
        CacheConfig config = new CacheConfig();
        config.setMaxUpdateRetries(1);
        impl = new MemcachedHttpCacheStorage(mockMemcachedClient, config,
                mockSerializer);
    }
View Full Code Here


     * 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 DefaultHttpCacheEntrySerializer());
    }
View Full Code Here

        removeCache();
    }
   
    @Test
    public void testIssue1147() throws Exception {
        CacheConfig cacheConfig = new CacheConfig();
        cacheConfig.setSharedCache(true);
        cacheConfig.setMaxObjectSizeBytes(262144); //256kb

        ResourceFactory resourceFactory = new FileResourceFactory(cacheDir);
        HttpCacheStorage httpCacheStorage = new ManagedHttpCacheStorage(cacheConfig);

        HttpClient client = EasyMock.createMock(HttpClient.class);
View Full Code Here

      int socketTimeout = readFromProperty("bdSocketTimeout", globalTimeout);
      RequestConfig requestConfig = RequestConfig.copy(RequestConfig.DEFAULT).setConnectTimeout(connectTimeout)
        .setSocketTimeout(socketTimeout).setConnectionRequestTimeout(connectionRequestTimeout).build();

      // configure caching
      CacheConfig cacheConfig = CacheConfig.copy(CacheConfig.DEFAULT).setSharedCache(false).setMaxCacheEntries(1000)
        .setMaxObjectSize(2 * 1024 * 1024).build();

      // create the HTTP client
      return CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).setSslcontext(sslContext)
        .setDefaultRequestConfig(requestConfig).build();
View Full Code Here

    private HttpCacheEntrySerializer mockSerializer;

    @Override
    public void setUp() {
        mockCache = EasyMock.createNiceMock(Ehcache.class);
        final CacheConfig config = CacheConfig.custom().setMaxUpdateRetries(1).build();
        mockSerializer = EasyMock.createNiceMock(HttpCacheEntrySerializer.class);
        impl = new EhcacheHttpCacheStorage(mockCache, config, mockSerializer);
    }
View Full Code Here

    @Override
    @Before
    public void setUp() {
        super.setUp();
        params = new CacheConfig();
        params.setMaxObjectSizeBytes(MAX_BYTES);

        if (CACHE_MANAGER.cacheExists(TEST_EHCACHE_NAME)){
            CACHE_MANAGER.removeCache(TEST_EHCACHE_NAME);
        }
View Full Code Here

    private EhcacheHttpCacheStorage impl;
    private HttpCacheEntrySerializer mockSerializer;

    public void setUp() {
        mockCache = EasyMock.createMock(Ehcache.class);
        CacheConfig config = new CacheConfig();
        config.setMaxUpdateRetries(1);
        mockSerializer = EasyMock.createMock(HttpCacheEntrySerializer.class);
        impl = new EhcacheHttpCacheStorage(mockCache, config, mockSerializer);
    }
View Full Code Here

     * 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());
    }
View Full Code Here

    public MemcachedHttpCacheStorage(InetSocketAddress address) throws IOException {
        this(new MemcachedClient(address));
    }

    public MemcachedHttpCacheStorage(MemcachedClientIF cache) {
        this(cache, new CacheConfig(), new DefaultHttpCacheEntrySerializer());
    }
View Full Code Here

    private final Ehcache cache;
    private final HttpCacheEntrySerializer serializer;
    private final int maxUpdateRetries;

    public EhcacheHttpCacheStorage(Ehcache cache) {
        this(cache, new CacheConfig(), new DefaultHttpCacheEntrySerializer());
    }
View Full Code Here

TOP

Related Classes of org.apache.http.impl.client.cache.CacheConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.