Code example for Supplier

Methods: get

0
   } 
 
   @Provides 
   @TimeStamp 
   protected String provideTimeStamp(@TimeStamp Supplier<String> cache) {
      return cache.get();
   } 
 
   /** 
    * borrowing concurrency code to ensure that caching takes place properly 
    */ 
   @Provides 
   @TimeStamp 
   Supplier<String> provideTimeStampCache(@Named(Constants.PROPERTY_SESSION_INTERVAL) long seconds,
            final DateService dateService) {
      return Suppliers.memoizeWithExpiration(new Supplier<String>() {
         public String get() {
            return dateService.rfc822DateFormat();
         } 
      }, seconds, TimeUnit.SECONDS);