0

我想知道如何将缓存配置添加到 Vertx http Web 客户端。

使用 Apache http 客户端,我可以轻松设置setCacheConfig

PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager();
    connectionManager.setMaxTotal(configuration.getMaxTotalConnections());
    connectionManager.setDefaultMaxPerRoute(configuration.getDefaultMaxConnectionsPerRoute());
    HttpHost httpHost = new HttpHost(configuration.getHost(), configuration.getPort());
    connectionManager.setMaxPerRoute(new HttpRoute(httpHost), configuration.getMaxConnectionsPerRoute());

    CacheConfig cacheConfig = CacheConfig.custom()
        .setMaxCacheEntries(configuration.getMaxCacheEntries())
        .setMaxObjectSize(configuration.getMaxCacheObjectSize())
        .build();
    RequestConfig requestConfig = RequestConfig.custom()
        .setConnectTimeout(configuration.getRequestConnectTimeout())
        .setSocketTimeout(configuration.getRequestSocketTimeout())
        .build();
    httpClient = CachingHttpClients.custom()
        .setCacheConfig(cacheConfig)
        .setDefaultRequestConfig(requestConfig)
        .setConnectionManager(connectionManager)
        .build();

有任何想法吗?

4

1 回答 1

2

从 3.5.1 开始不支持它。您可以在Vert.x Web上提出问题。欢迎请求请求!

于 2018-03-28T19:54:56.933 回答