private long getExpiration(final OidcJsonWebKeyCacheKey givenService) {
        LOGGER.trace("Attempting to determine JWKS cache expiration value for [{}]", givenService);
        if (givenService.getRegisteredService() instanceof final OidcRegisteredService service) {
            if (StringUtils.isNotBlank(service.getJwksCacheDuration())) {
                val expiration = Beans.newDuration(service.getJwksCacheDuration()).toNanos();
                LOGGER.trace("JWKS cache expiration value for service [{}] is set to [{}]", service, expiration);
                return expiration;
            }
            val jwks = casProperties.getAuthn().getOidc().getJwks();
            val expiration = Beans.newDuration(jwks.getCore().getJwksCacheExpiration()).toNanos();
            LOGGER.trace("CAS JWKS cache expiration value is set to [{}]", expiration);
            return expiration;
        }
        return -1;
    }
This is {@link OidcServiceJsonWebKeystoreCacheExpirationPolicy}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/OidcServiceJsonWebKeystoreCacheExpirationPolicy.java