Class CaffeinatedGuava


  • public final class CaffeinatedGuava
    extends Object
    An adapter to expose a Caffeine cache through the Guava interfaces.
    • Method Detail

      • build

        @CheckReturnValue
        public static <K,​V,​K1 extends K,​V1 extends V> Cache<K1,​V1> build​(Caffeine<K,​V> builder)
        Returns a Caffeine cache wrapped in a Guava Cache facade.
        Parameters:
        builder - the configured cache builder
        Returns:
        a cache exposed under the Guava APIs
      • build

        @CheckReturnValue
        public static <K,​V,​K1 extends K,​V1 extends V> LoadingCache<K1,​V1> build​(Caffeine<K,​V> builder,
                                                                                                        CacheLoader<? super K1,​V1> loader)
        Returns a Caffeine cache wrapped in a Guava LoadingCache facade.
        Parameters:
        builder - the configured cache builder
        loader - the cache loader used to obtain new values
        Returns:
        a cache exposed under the Guava APIs
      • build

        @CheckReturnValue
        public static <K,​V,​K1 extends K,​V1 extends V> LoadingCache<K1,​V1> build​(Caffeine<K,​V> builder,
                                                                                                        CacheLoader<? super K1,​V1> loader)
        Returns a Caffeine cache wrapped in a Guava LoadingCache facade.
        Parameters:
        builder - the configured cache builder
        loader - the cache loader used to obtain new values
        Returns:
        a cache exposed under the Guava APIs