Last active
January 16, 2019 22:16
-
-
Save connorboyd/e764189ff5701e4b239aa1cdf6dff0b8 to your computer and use it in GitHub Desktop.
First SystemDateProvider code snippet for Wealthfront engineering blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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