Class CacheUtil

java.lang.Object
com.sap.cloud.sdk.cloudplatform.cache.CacheUtil

public final class CacheUtil extends Object
Util class containing helper methods to work with caches.
  • Method Details

    • wrapCallableAsFunction

      @Nonnull public static <K, V> Function<K,V> wrapCallableAsFunction(@Nonnull Callable<V> callable)
      Wraps the given Callable into a function that ignores the given parameter.

      Every Exception thrown by the Callable will be wrapped in a CacheRuntimeException so that the returned Function does not throw any checked Exceptions.

      Type Parameters:
      K - The type of the ignored key.
      V - The type of the value returned by the Callable and Function.
      Parameters:
      callable - The Callable to wrap.
      Returns:
      A Function executing the given Callable without looking at the parameter.
    • wrapSupplierAsFunction

      @Nonnull public static <K, V> Function<K,V> wrapSupplierAsFunction(@Nonnull Supplier<V> supplier)
      Wraps the given Supplier into a function that ignores the given parameter.
      Type Parameters:
      K - The type of the ignored key.
      V - The type of the value returned by the Supplier and Function.
      Parameters:
      supplier - The Supplier to wrap.
      Returns:
      A Function executing the given Supplier without looking at the parameter.