Guest User

Untitled

a guest
Jan 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. public class SystemDateProvider implements Provider<LocalDate> {
  2.  
  3.  private final Supplier<LocalDate> supplier =
  4.    Suppliers.memoizeWithExpiration(this::loadSystemDate, 1, MINUTES);
  5.  
  6.  private LocalDate loadSystemDate() {
  7.    // Load from database
  8.  }
  9.  
  10.  @Override
  11.  public LocalDate get() {
  12.    return supplier.get();
  13.  }
  14.  
  15. }
Add Comment
Please, Sign In to add comment