I'm trying to get this cache to refresh every day at 3AM. The problem is that users are having to wait a long time for the cache to warm up. So I would rather it be refreshed overnight and be ready to quickly access in the morning for the UI.
return CacheBuilder.newBuilder()
.maximumSize(1000)
.expireAfterAccess(1, TimeUnit.DAYS)
.build(new CacheLoader<String, Long>() {
@Override
public Long load(String key)
throws Exception {
return db.getMetrics(key);
}
});
I want to be able to provide a fixed set of keys in the cache to refresh at 3AM.
I read the Google documentation but it seems like that only refreshes data that's already been loaded in the cache.
TL;DR - Looking to warm up the cache with a fixed set of keys at a specific time during the day