@Override
    public long count(final String uid) {
        return lock.tryLock(() -> {
            val tokens = this.storage.getIfPresent(uid);
            LOGGER.debug("Found used tokens [{}]", tokens);
            if (tokens != null) {
                return tokens.size();
            }
            return 0;
        });
    }
This is {@link CachingOneTimeTokenRepository}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-otp-mfa-core/src/main/java/org/apereo/cas/otp/repository/token/CachingOneTimeTokenRepository.java