All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arangodb.shaded.vertx.ext.web.client.CachingWebClient Maven / Gradle / Ivy

There is a newer version: 7.8.0
Show newest version
/*
 * Copyright 2021 Red Hat, Inc.
 *
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  and Apache License v2.0 which accompanies this distribution.
 *
 *  The Eclipse Public License is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  The Apache License v2.0 is available at
 *  http://www.opensource.org/licenses/apache2.0.php
 *
 *  You may elect to redistribute this code under either of these licenses.
 */
package com.arangodb.shaded.vertx.ext.web.client;

import com.arangodb.shaded.vertx.codegen.annotations.GenIgnore;
import com.arangodb.shaded.vertx.codegen.annotations.VertxGen;
import com.arangodb.shaded.vertx.ext.web.client.impl.CachingWebClientImpl;
import com.arangodb.shaded.vertx.ext.web.client.impl.cache.LocalCacheStore;
import com.arangodb.shaded.vertx.ext.web.client.spi.CacheStore;

/**
 * An asynchronous cache aware HTTP / HTTP/2 client called {@code CachingWebClient}.
 * 

* This client wraps a {@link WebClient} and makes it cache aware by adding features to it: *

    *
  • Cache-Control header parsing
  • *
  • Freshness checking
  • *
*

* The client honors the following cache headers: *

    *
  • Cache-Control with the following properties understood: *
      *
    • public
    • *
    • private
    • *
    • no-cache
    • *
    • no-store
    • *
    • max-age
    • *
    • s-maxage
    • *
    • stale-if-error
    • *
    • staile-while-revalidate
    • *
    • must-revalidate
    • *
    *
  • *
  • Expires
  • *
  • ETag
  • *
  • Vary
  • *
*

* * @author Craig Day */ @VertxGen public interface CachingWebClient { /** * Create a cache aware web client using the provided {@link WebClient}. * * @param webClient the web client instance * @return the created web client */ @GenIgnore(GenIgnore.PERMITTED_TYPE) static WebClient create(WebClient webClient) { return create(webClient, new LocalCacheStore()); } /** * Create a cache aware web client using the provided {@link WebClient}. * * @param webClient the web client instance * @param cacheStore the cache adapter * @return the created web client */ @GenIgnore(GenIgnore.PERMITTED_TYPE) static WebClient create(WebClient webClient, CacheStore cacheStore) { return create(webClient, cacheStore, new CachingWebClientOptions()); } /** * Create a cache aware web client using the provided {@link WebClient}. * * @param webClient the web client instance * @param options the caching web client options * @return the created web client */ @GenIgnore(GenIgnore.PERMITTED_TYPE) static WebClient create(WebClient webClient, CachingWebClientOptions options) { return create(webClient, new LocalCacheStore(), options); } /** * Create a cache aware web client using the provided {@link WebClient}. * * @param webClient the web client instance * @param cacheStore the cache adapter * @param options the caching web client options * @return the created web client */ @GenIgnore(GenIgnore.PERMITTED_TYPE) static WebClient create(WebClient webClient, CacheStore cacheStore, CachingWebClientOptions options) { return CachingWebClientImpl.wrap(webClient, cacheStore, options); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy