@Override
    public long expireAfterCreate(
        @Nonnull
        final String key,
        @Nonnull final MultifactorAuthenticationTrustRecord value, final long currentTime) {
        if (value.getExpirationDate() == null) {
            LOGGER.trace("Multifactor trust record [{}] will never expire", value);
            return Long.MAX_VALUE;
        }
        if (value.isExpired()) {
            LOGGER.trace("Multifactor trust record [{}] is expired", value);
            return 0;
        }
        val now = ZonedDateTime.now(ZoneOffset.UTC).truncatedTo(ChronoUnit.SECONDS);
        val zonedExp = DateTimeUtils.zonedDateTimeOf(value.getExpirationDate()).truncatedTo(ChronoUnit.SECONDS);
        val nanos = Duration.between(now, zonedExp).toNanos();
        LOGGER.trace("Multifactor trust record [{}] expires in [{}] nanoseconds", value, nanos);
        return nanos;
    }
This is {@link MultifactorAuthenticationTrustRecordExpiry}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-trusted-mfa-core/src/main/java/org/apereo/cas/trusted/authentication/storage/MultifactorAuthenticationTrustRecordExpiry.java