Class BambooSuppliers


  • public class BambooSuppliers
    extends Object
    • Constructor Detail

      • BambooSuppliers

        public BambooSuppliers()
    • Method Detail

      • memoizeWithFixedTtl

        @NotNull
        public static <T> @NotNull Supplier<T> memoizeWithFixedTtl​(@NotNull
                                                                   @NotNull Supplier<T> supplier,
                                                                   @NotNull
                                                                   @NotNull Duration ttl)
        Memoizes the provided supplier. The value is guaranteed to be no more than ttl old. TTL countdown starts when the provided supplier's get method returns.
      • memoizeWithAdaptiveTtl

        @NotNull
        public static <T> @NotNull Supplier<T> memoizeWithAdaptiveTtl​(Supplier<T> supplier,
                                                                      Duration minTtl,
                                                                      Duration maxTtl)
        Memoizes the provided supplier. The value is guaranteed to be no more than <minTtl;maxTtl> old. The actual TTL value used is equal to the time taken by the supplier.get(), capped by the ttl range. TTL countdown starts when the provided supplier's get method returns.