Skip to content

Instantly share code, notes, and snippets.

@connorboyd
Created January 16, 2019 22:10
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save connorboyd/7fee749b0bf7e55964d64f1c7bf677ec to your computer and use it in GitHub Desktop.
Second SystemDateProvider code snippet for Wealthfront engineering blog
@Singleton
public class SystemDateProvider implements Provider<LocalDate> {
 private final Supplier<LocalDate> supplier =
   Suppliers.memoizeWithExpiration(this::loadSystemDate, 1, MINUTES);
 private LocalDate loadSystemDate() {
   // Load from database
 }
 @Override
 public LocalDate get() {
   return supplier.get();
 }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment