Thanks to this forum ( How to automatically update the cache using Google Guava? ), I learned about Guava.
I wanted to ask some information on the above topic ( How to automatically update the cache using Google Guava? ), But I can not write comments for the questions, because my reputation is also low. Therefore, I have to create a new topic. Thank you for your understanding.
Seeing this code
LoadingCache<K, V> cache = CacheBuilder.newBuilder()
.refreshAfterWrite(15, TimeUnit.MINUTES)
.maximumSize(100)
.build(new MyCacheLoader());
if one record A is loaded with its value at least once, is the code above enough to automatically restart every 15 minutes the value associated with key A?
Of course, as Frank mentioned, "I override the CacheBuilder.reload (K, V) method in MyCacheLoader, so it runs asynchronously." Or do I have code to add? If so, where? Many thanks
PS: JB, javadoc is perfect, but my level in English is low. In fact, an overridden reboot of my CacheLoader shows whether it is necessary to perform a real reboot for the key, and, if so, to implement a real reboot for this key; otherwise, do not really reload the cache for this key. And even in the second case (without a real reboot), do I have a call to my overridden reboot method every 15 minutes? I think so, but right? Thanks
source
share