Redis async cluster support

I'm going to use redis-rs (looks like the most popular crate).
It support async and cluster. I need both.

redis = { version = "0.22.1", features = ["cluster", "tokio-comp", "aio"] }

But looks like cluster only supports sync code.
I can execute the following sync code base:

#[tokio::test]
    async fn cluster_redis_api() {
        let node = "redis://127.0.0.1:6379";
        let cluster = ClusterClient::new(vec![node]).unwrap();
        let mut cluster_conn = cluster.get_connection().unwrap();
        let result: RedisResult<String> = redis::cmd("PING")
            .query(&mut cluster_conn);
        let result = result.unwrap();
        assert_eq!(result, "PONG".to_string());
    }

But I can't even compile async version:

#[tokio::test]
    async fn cluster_redis_api() {
        let node = "redis://127.0.0.1:6379";
        let cluster = ClusterClient::new(vec![node]).unwrap();
        let mut cluster_conn = cluster.get_connection().unwrap();
        let result: RedisResult<String> = redis::cmd("PING")
            .query_async(&mut cluster_conn);
        let result = result.unwrap();
        assert_eq!(result, "PONG".to_string());
    }
.query_async(&mut cluster_conn);
------- ^^^^^^^^^^^^^ the trait `redis::aio::ConnectionLike` is not implemented for `ClusterConnection`

Does anybody use cluster with async?

If somebody faces the same then possible workaround is redis-cluster-async crate usage.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.