Skip to content

Commit

Permalink
bruk kotlin annoteringer for å redefinere getters
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Olav Eide committed Oct 14, 2024
1 parent 22c3c9b commit be53395
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ object OAuth2CacheFactory {
private fun <T> evictOnResponseExpiresIn(skewInSeconds : Long) : Expiry<T, OAuth2AccessTokenResponse> {
return object : Expiry<T, OAuth2AccessTokenResponse> {
override fun expireAfterCreate(key : T, response : OAuth2AccessTokenResponse, currentTime : Long) =
SECONDS.toNanos(if (response.expiresIn!! > skewInSeconds) response.expiresIn - skewInSeconds else response.expiresIn.toLong())
SECONDS.toNanos(if (response.expires_in!! > skewInSeconds) response.expires_in!! - skewInSeconds else response.expires_in!!.toLong())
override fun expireAfterUpdate(key : T, response : OAuth2AccessTokenResponse, currentTime : Long, currentDuration : Long) = currentDuration
override fun expireAfterRead(key : T, response : OAuth2AccessTokenResponse, currentTime : Long, currentDuration : Long) = currentDuration
}
Expand Down

0 comments on commit be53395

Please sign in to comment.