Interface CacheStore


public interface CacheStore
An API to store and retrieve HTTP responses.
Author:
Craig Day
  • Method Summary

    Modifier and Type
    Method
    Description
    static CacheStore
    Builds a no-op cache store.
    delete(io.vertx.ext.web.client.impl.cache.CacheKey key)
    Delete a key from the cache.
    default void
    delete(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<Void>> handler)
    Delete all variations of a key from the cache.
    Delete all entries from the cache.
    default void
    Delete all entries from the cache.
    Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>
    get(io.vertx.ext.web.client.impl.cache.CacheKey key)
    Retrieve a cached response.
    default void
    get(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
    Retrieve a cached response.
    static CacheStore
    Builds a cache store that uses a ConcurrentHashMap.
    Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>
    set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response)
    Add a response in the cache with the given key.
    default void
    set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
    Add a response in the cache with the given key.
    static CacheStore
    Builds a cache store that uses an AsyncMap from SharedData.
  • Method Details

    • build

      static CacheStore build()
      Builds a no-op cache store.
      Returns:
      the new cache store
    • sharedDataStore

      static CacheStore sharedDataStore(Vertx vertx)
      Builds a cache store that uses an AsyncMap from SharedData.
      Parameters:
      vertx - the vertx instance
      Returns:
      the new cache store
    • localStore

      static CacheStore localStore()
      Builds a cache store that uses a ConcurrentHashMap.
      Returns:
      the new cache store
    • get

      Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse> get(io.vertx.ext.web.client.impl.cache.CacheKey key)
      Retrieve a cached response.
      Parameters:
      key - the key to retrieve
      Returns:
      the response as stored in the cache
    • set

      Future<io.vertx.ext.web.client.impl.cache.CachedHttpResponse> set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response)
      Add a response in the cache with the given key.
      Parameters:
      key - the key to store the response at
      response - the response to store
      Returns:
      the response
    • delete

      Future<Void> delete(io.vertx.ext.web.client.impl.cache.CacheKey key)
      Delete a key from the cache.
      Parameters:
      key - the key to delete
      Returns:
      a future so the API can be composed fluently
    • flush

      Future<Void> flush()
      Delete all entries from the cache.
      Returns:
      a future so the API can be composed fluently
    • get

      default void get(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
      Retrieve a cached response.
      Parameters:
      key - the key to retrieve
      handler - a handler to receive the cached response
      See Also:
    • set

      default void set(io.vertx.ext.web.client.impl.cache.CacheKey key, io.vertx.ext.web.client.impl.cache.CachedHttpResponse response, Handler<AsyncResult<io.vertx.ext.web.client.impl.cache.CachedHttpResponse>> handler)
      Add a response in the cache with the given key.
      Parameters:
      key - the key to store the response at
      response - the response to store
      handler - a handler to receive the stored response
      See Also:
    • delete

      default void delete(io.vertx.ext.web.client.impl.cache.CacheKey key, Handler<AsyncResult<Void>> handler)
      Delete all variations of a key from the cache.
      Parameters:
      key - the key to delete
      handler - a handler to receive the delete result
      See Also:
    • flush

      default void flush(Handler<AsyncResult<Void>> handler)
      Delete all entries from the cache.
      Parameters:
      handler - a handler to receive the flush result.
      See Also: