title: How to refresh the key and value in cache after they are expired in Guava (Spring)
body: <p>So, I was looking at caching methods in Java (Spring). And Guava looked like it would solve the purpose. </p>
  
  <p>This is the usecase - </p>
  
  <p>I query for some data from a remote service. Kind of configuration field for my application. This field will be used by every inbound request to my application. And it would be expensive to call the remote service everytime as it's kind of constant which changes periodically. </p>
  
  <p>So, on the first request inbound to my application, when I call remote service, I would cache the value. I set an expiry time of this cache as 30 mins. After 30 mins when the cache is expired and there is a request to retrieve the key, I would like a callback or something to do the operation of calling the remote service and setting the cache and return the value for that key. </p>
  
  <p>How can I do it in Guava cache?</p>