public Mono<UserRelationshipsWithVersion> queryRelationshipsWithVersion(
            @NotNull Long ownerId,
            @Nullable Set<Long> relatedUserIds,
            @Nullable Set<Integer> groupIndexes,
            @Nullable Boolean isBlocked,
            @Nullable Date lastUpdatedDate) {
        return userVersionService.queryRelationshipsLastUpdatedDate(ownerId)
                .flatMap(date -> {
                    if (DateTimeUtil.isAfterOrSame(lastUpdatedDate, date)) {
                        return ResponseExceptionPublisherPool.alreadyUpToUpdate();
                    }
                    Recyclable<Set<UserRelationship>> recyclableSet = SetRecycler.obtain();
                    return queryRelationships(Set
                            .of(ownerId), relatedUserIds, groupIndexes, isBlocked, null, null, null)
                            .collect(Collectors.toCollection(recyclableSet::getValue))
                            .map(relationships -> {
                                if (relationships.isEmpty()) {
                                    throw ResponseException.get(ResponseStatusCode.NO_CONTENT);
                                }
                                UserRelationshipsWithVersion.Builder builder =
                                        ClientMessagePool.getUserRelationshipsWithVersionBuilder()
                                                .setLastUpdatedDate(date.getTime());
                                UserRelationship.Key relationshipKey;
                                Pair<Long, Long> cacheKey;
                                boolean blocked;
                                for (UserRelationship relationship : relationships) {
                                    relationshipKey = relationship.getKey();
                                    cacheKey = Pair.of(ownerId, relationshipKey.getRelatedUserId());
                                    blocked = relationship.getBlockDate() != null;
                                    ownerIdAndRelatedUserIdToHasRelationshipAndNotBlockedCache
                                            .put(cacheKey, !blocked);
                                    ownerIdAndRelatedUserIdToIsBlockedCache.put(cacheKey, blocked);
                                    builder.addUserRelationships(
                                            ProtoModelConvertor.relationship2proto(relationship));
                                }
                                return builder.build();
                            })
                            .doFinally(signalType -> recyclableSet.recycle());
                })
                .switchIfEmpty(ResponseExceptionPublisherPool.alreadyUpToUpdate());
    }
@return true if the relationship existed and has been deleted;
        <p>
        false if the relationship does not exist, or still exists and has been deleted from a
        relationship group.
turms-service/src/main/java/im/turms/service/domain/user/service/UserRelationshipService.java