You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importorg.springframework.cache.interceptor.SimpleKeyval cache:Cache<SimpleKey, String> =Caffeine.newBuilder()
.maximumSize(1)
.build();
// use caseval token = cache.getOrLoad(
SimpleKey.EMPTY,
SomeValueLoaderInterfaceIHaveToImplement {
val response = restClient.getToken()
val value:String= response.token
val ttl:Long= response.expiresIn
// must return value to ttl pairreturnSomePair(token, Duration.ofSeconds(ttl))
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Beta Was this translation helpful? Give feedback.
All reactions