summaryrefslogtreecommitdiff
path: root/redis/commands/core.py
diff options
context:
space:
mode:
authorAlibi <aliby.bbb@gmail.com>2022-08-21 15:18:02 +0600
committerGitHub <noreply@github.com>2022-08-21 12:18:02 +0300
commit031b2087b57713d29b98140fb1f0b9f7b4fc7a21 (patch)
tree9426e49702885165479c2616b2cbce7b8207f521 /redis/commands/core.py
parente95b05a8df4d45d0c8186ac37f57d9edd9235820 (diff)
downloadredis-py-031b2087b57713d29b98140fb1f0b9f7b4fc7a21.tar.gz
Add BITFIELD_RO (#2340)
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r--redis/commands/core.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py
index 6cf0457..51f30d2 100644
--- a/redis/commands/core.py
+++ b/redis/commands/core.py
@@ -1504,6 +1504,29 @@ class BasicKeyCommands(CommandsProtocol):
"""
return BitFieldOperation(self, key, default_overflow=default_overflow)
+ def bitfield_ro(
+ self: Union["Redis", "AsyncRedis"],
+ key: KeyT,
+ encoding: str,
+ offset: BitfieldOffsetT,
+ items: Optional[list] = None,
+ ) -> ResponseT:
+ """
+ Return an array of the specified bitfield values
+ where the first value is found using ``encoding`` and ``offset``
+ parameters and remaining values are result of corresponding
+ encoding/offset pairs in optional list ``items``
+ Read-only variant of the BITFIELD command.
+
+ For more information see https://redis.io/commands/bitfield_ro
+ """
+ params = [key, "GET", encoding, offset]
+
+ items = items or []
+ for encoding, offset in items:
+ params.extend(["GET", encoding, offset])
+ return self.execute_command("BITFIELD_RO", *params)
+
def bitop(self, operation: str, dest: KeyT, *keys: KeyT) -> ResponseT:
"""
Perform a bitwise operation using ``operation`` between ``keys`` and