====== Guava Supplier ====== * [[java:guava:cachebuilder|Guava CacheBuilder]]와는 다르게 단일 데이터를 저장하고, 일정 시간이 지나면 expire 가능하다. * [[https://google.github.io/guava/releases/21.0/api/docs/com/google/common/base/Suppliers.html|Guava Suppliers]] * [[https://www.stubbornjava.com/posts/lazy-loading-and-caching-objects-in-java-with-guava-s-suppliers-memoize|Lazy loading and caching objects in Java with Guava's Suppliers.memoize]] * [[http://www.baeldung.com/guava-memoizer|Introduction to Guava Memoizer]] * [[http://www.javacodegeeks.com/2014/11/need-micro-caching-memoization-to-the-rescue.html|Suppliers.memoize()를 통한 마이크로 캐싱]] ===== Example ===== // CostlySupplier::generateBigNumber 가 실제 데이터를 제공해줄 lambda Supplier memoizedSupplier = Suppliers.memoizeWithExpiration( CostlySupplier::generateBigNumber, 5, TimeUnit.SECONDS);