Interface Cache


@Unstable public interface Cache
Cache SPI.
  • Method Summary

    Modifier and Type
    Method
    Description
    get(String key)
    Being called when the proxy attempts to fetch a cache item.
    put(String key, Resource value)
    Being called when the proxy attempts to add a new cache item.
    Being called when the proxy attempts to delete a cache item, typically caused by invalidating an existing item.
  • Method Details

    • put

      Future<Void> put(String key, Resource value)
      Being called when the proxy attempts to add a new cache item. The cache can only store up to maxSize of the latest items based on CacheOptions.
      Parameters:
      key - the URI of the resource
      value - the cached response
      Returns:
      a succeed void future
    • get

      Future<Resource> get(String key)
      Being called when the proxy attempts to fetch a cache item.
      Parameters:
      key - the URI of the resource
      Returns:
      the cached response, null if not exist, should all wrap with future
    • remove

      Future<Void> remove(String key)
      Being called when the proxy attempts to delete a cache item, typically caused by invalidating an existing item. Do nothing if not exist.
      Parameters:
      key - the URI of the resource
      Returns:
      a succeed void future