@Override
    public Stream<? extends Ticket> stream(final TicketRegistryStreamCriteria criteria) {
        return fetchKeysForTickets()
            .skip(criteria.getFrom())
            .limit(criteria.getCount())
            .map(redisKey -> {
                val compositeKey = RedisKeyGenerator.parse(redisKey);
                val redisKeyGenerator = redisKeyGeneratorFactory.getRedisKeyGenerator(compositeKey.getPrefix()).orElseThrow();
                val keyspace = redisKeyGenerator.getKeyspace();
                val entryId = redisKeyGenerator.rawKey(redisKey);
                val document = redisKeyValueAdapter.get(entryId, keyspace, RedisTicketDocument.class);
                if (document == null) {
                    casRedisTemplates.getTicketsRedisTemplate().delete(redisKey);
                    return null;
                }
                return document;
            })
            .filter(Objects::nonNull)
            .map(document -> deserializeTicket(document.json(), document.type()))
            .map(this::decodeTicket)
            .filter(Objects::nonNull)
            .peek(ticket -> {
                if (!ticket.isExpired()) {
                    val redisKeyGenerator = redisKeyGeneratorFactory.getRedisKeyGenerator(ticket.getPrefix()).orElseThrow();
                    val redisTicketsKey = redisKeyGenerator.forPrefixAndId(ticket.getPrefix(), digestIdentifier(ticket.getId()));
                    ticketCache.ifAvailable(cache -> cache.put(redisKeyGenerator.rawKey(redisTicketsKey), ticket));
                }
            });
    }
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