private Ticket addTicketToCassandra(final Ticket ticket, final boolean inserting) throws Exception {
        LOGGER.debug("Adding ticket [{}]", ticket.getId());
        val metadata = ticketCatalog.find(ticket);
        LOGGER.trace("Located ticket definition [{}] in the ticket catalog", metadata);
        val encTicket = encodeTicket(ticket);
        val data = ticketSerializationManager.serializeTicket(encTicket);
        val ttl = getTimeToLive(ticket);
        var statement = (SimpleStatement) null;

        val attributeMap = (Map<String, List>) collectAndDigestTicketAttributes(ticket);
        val attributesEncoded = attributeMap
            .entrySet()
            .stream()
            .map(entry -> {
                val entryValues = entry.getValue();
                val valueList = entryValues.stream().map(Object::toString).collect(Collectors.joining(","));
                return Pair.of(entry.getKey(), valueList);
            })
            .collect(Collectors.toMap(Pair::getKey, v -> v.getValue().toString()));

        if (inserting) {
            val document = CassandraTicketHolder.builder()
                .id(encTicket.getId())
                .data(data)
                .prefix(ticket.getPrefix())
                .type(encTicket.getClass().getName())
                .attributes(attributesEncoded)
                .build();
            val json = MAPPER.writeValueAsString(document);
            statement = QueryBuilder.insertInto(properties.getKeyspace(), metadata.getProperties().getStorageName())
                .json(json)
                .usingTtl(ttl)
                .build();
        } else {
            statement = QueryBuilder.update(properties.getKeyspace(), metadata.getProperties().getStorageName())
                .usingTtl(ttl)
                .setColumn("data", QueryBuilder.literal(data))
                .setColumn("attributes", QueryBuilder.literal(attributesEncoded))
                .whereColumn("id").isEqualTo(QueryBuilder.literal(encTicket.getId()))
                .whereColumn("type").isEqualTo(QueryBuilder.literal(encTicket.getClass().getName()))
                .build();
        }
        statement = statement.setConsistencyLevel(DefaultConsistencyLevel.valueOf(properties.getConsistencyLevel()))
            .setSerialConsistencyLevel(DefaultConsistencyLevel.valueOf(properties.getSerialConsistencyLevel()))
            .setTimeout(Beans.newDuration(properties.getTimeout()));

        LOGGER.trace("Attempting to locate ticket via query [{}]", statement.getQuery());
        cassandraSessionFactory.getCqlTemplate().execute(statement);
        LOGGER.debug("Added ticket [{}]", encTicket.getId());
        return ticket;
    }
This is {@link CassandraTicketRegistry}.

@author Misagh Moayyed
@author doomviking
@since 6.1.0
support/cas-server-support-cassandra-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/CassandraTicketRegistry.java