hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1487) CachingHttpClient doesn't persist cache
Date Wed, 19 Mar 2014 08:57:47 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13940315#comment-13940315

Oleg Kalnichevski commented on HTTPCLIENT-1487:

In default configuration caching HttpClient deletes cache entries in disk when shut down.
I personally do not think this is unreasonable. 
CacheConfig config = CacheConfig.DEFAULT;
CloseableHttpClient client = CachingHttpClients.custom()
    .setCacheDir(new File("my-cache"))

One can override the default behavior by managing cache storage manually.
CacheConfig config = CacheConfig.DEFAULT;
FileResourceFactory resourceFactory = new FileResourceFactory(new File("my-cache"));
ManagedHttpCacheStorage cacheStorage = new ManagedHttpCacheStorage(config);
CloseableHttpClient client = CachingHttpClients.custom()

// This will not affect cache storage
// use #cleanResources instead of #close to preserve valid cache entries


> CachingHttpClient doesn't persist cache
> ---------------------------------------
>                 Key: HTTPCLIENT-1487
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1487
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>            Reporter: Chris Oliver
>            Assignee: Jon Moore
>            Priority: Blocker
> Unless I'm mistaken, the current implementation doesn't maintain the cache between executions
of the java process. In addition, it appears the current api for HttpCacheStorage makes it
difficult / error prone to do this myself, since my implementation would have to somehow produce
an HttpCacheEntry. Any suggestions?

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org

View raw message