0

I'm wondering how to add a cache config to Vertx http web client.

With Apache http client, I could do easily set the 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();

Any ideas?

Philip K. Adetiloye
  • 3,102
  • 4
  • 37
  • 63

1 Answers1

2

It's not supported as of 3.5.1. You can file an issue on the Vert.x Web. Pull requests welcome!

tsegismont
  • 8,591
  • 1
  • 17
  • 27