Class Cache

java.lang.Object
org.apache.beam.io.requestresponse.Cache

public final class Cache extends Object
Transforms for reading and writing request/response associations to a cache.
  • Constructor Details

    • Cache

      public Cache()
  • Method Details

    • usingRedis

      public static <RequestT, ResponseT> Cache.Pair<RequestT,ResponseT> usingRedis(URI uri, Coder<RequestT> requestTCoder, Coder<ResponseT> responseTCoder, Duration expiry) throws Coder.NonDeterministicException
      Builds a Cache.Pair using a Redis cache to read and write Cache and Cache pairs. The purpose of the cache is to offload Caches from the API and instead return the Cache if the association is known. Since the Caches and Caches need encoding and decoding, checks are made whether the requestTCoder and responseTCoders are Coder.verifyDeterministic(). This feature is only appropriate for API reads such as HTTP list, get, etc.
      Below describes the parameters in more detail and their usage.
      • URI uri - the URI of the Redis instance.
      • Coder<RequestT> requestTCoder - the Cache Coder to encode and decode Caches during cache read and writes.
      • Duration expiry - the duration to hold Cache and Cache pairs in the cache.
      Throws:
      Coder.NonDeterministicException