Skip to content

Broadcast commands in Cluster connection classes #2599

Open
@uglide

Description

@uglide

Cluster connection classes should provide overrides for specific Redis Core and module commands to make them easy to use with OS Cluster API.

import redis
from redis.commands.json.path import Path

r = redis.RedisCluster(host="localhost", port=16379)

doc = {
    "a": 1,
    "user":{
        "name": "Paul John",
        "email": "paul.john@example.com",
        "a": 11,
        "city": "London"
    }
}

doc2 = {
    "a": 2,
    "user":{
        "name": "Paul John",
        "email": "paul.john@example.com",
        "a": 22,
        "city": "London"
    }
}

rj = r.json()

rj.set("doc1", Path.root_path(), doc)
rj.set("doc2", Path.root_path(), doc2)

# Both mget commands should return all documents from cluster
print(rj.mget(["doc1", "doc2"], "$..a"))
print(rj.mget(["doc2", "doc1"], "$..a"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions