@Override
    public long countTicketsFor(final Service service) {
        return redisModulesOperations
            .stream()
            .map(command -> {
                val originalUrl = URI.create(service.getOriginalUrl());
                val host = String.format("%s?//%s", originalUrl.getScheme(), originalUrl.getHost());
                val query = String.format("@%s:\"%s\"", RedisTicketDocument.FIELD_NAME_SERVICE, host);
                return command.search(SEARCH_INDEX_NAME, query)
                    .map(RedisTicketDocument::from)
                    .filter(document -> StringUtils.isNotBlank(document.json()))
                    .map(redisDoc -> {
                        val ticket = deserializeTicket(redisDoc.json(), redisDoc.type());
                        return decodeTicket(ticket);
                    })
                    .filter(ticket -> !ticket.isExpired())
                    .count();
            })
            .findFirst()
            .orElseGet(() -> super.countTicketsFor(service));
    }
Key-value ticket registry implementation that stores tickets in redis.

@author Misagh Moayyed
@author Jerome Leleu
@since 5.1.0
support/cas-server-support-redis-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/RedisTicketRegistry.java