org.gradle.caching.http

## Class HttpBuildCache

- java.lang.Object
- - org.gradle.caching.configuration.AbstractBuildCache
  - - org.gradle.caching.http.HttpBuildCache

- All Implemented Interfaces:
    BuildCache

      @Incubating
      public class HttpBuildCache
      extends AbstractBuildCache

  Configuration object for the HTTP build cache. The build cache only supports BASIC authentication currently.

  Cache entries are loaded via GET and stored via PUT requests.

  For a GET request we expect a 200 or 404 response and for PUT we expect any 2xx response. Other responses are treated as recoverable or non-recoverable errors, depending on the status code. E.g. we treat authentication failures (401 and 409) as non-recoverable while an internal server error (500) is recoverable.
  Since:
    3.5

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpBuildCache()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `credentials(Action<? super HttpBuildCacheCredentials> configuration)` Configures the credentials used to access the HTTP cache backend.
    `HttpBuildCacheCredentials` | `getCredentials()` Returns the credentials used to access the HTTP cache backend.
    `URI` | `getUrl()` Returns the URI to the cache.
    `void` | `setUrl(String url)` Sets the URL of the cache.
    `void` | `setUrl(URI url)`
    `void` | `setUrl(URL url)` Sets the URL of the cache.

    - ### Methods inherited from class org.gradle.caching.configuration.AbstractBuildCache

      `isEnabled, isPush, setEnabled, setPush`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpBuildCache

          public HttpBuildCache()

  - ### Method Detail

    - #### getUrl

          @Nullable
          public URI getUrl()

      Returns the URI to the cache.

    - #### setUrl

          public void setUrl(String url)

      Sets the URL of the cache. The URL must end in a '/'.

    - #### setUrl

          public void setUrl(URL url)
                      throws URISyntaxException

      Sets the URL of the cache. The URL must end in a '/'.
      Throws:
        `URISyntaxException`

    - #### setUrl

          public void setUrl(URI url)

    - #### getCredentials

          public HttpBuildCacheCredentials getCredentials()

      Returns the credentials used to access the HTTP cache backend.

    - #### credentials

          public void credentials(Action<? super HttpBuildCacheCredentials> configuration)

      Configures the credentials used to access the HTTP cache backend.