Skip to content

Add aliases for nonatomic versions of mget/mset #2909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
* Fix for Unhandled exception related to self.host with unix socket (#2496)
* Improve error output for master discovery
* Make `ClusterCommandsProtocol` an actual Protocol
* Add alias for Redis version of mget_nonatomic/mset_nonatomic

* 4.1.3 (Feb 8, 2022)
* Fix flushdb and flushall (#1926)
Expand Down
4 changes: 4 additions & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,6 +2014,8 @@ def mget(self, keys: KeysT, *args: EncodableT) -> ResponseT:
options[EMPTY_RESPONSE] = []
return self.execute_command("MGET", *args, **options)

mget_nonatomic = mget

def mset(self, mapping: Mapping[AnyKeyT, EncodableT]) -> ResponseT:
"""
Sets key/values based on a mapping. Mapping is a dictionary of
Expand All @@ -2027,6 +2029,8 @@ def mset(self, mapping: Mapping[AnyKeyT, EncodableT]) -> ResponseT:
items.extend(pair)
return self.execute_command("MSET", *items)

mset_nonatomic = mset

def msetnx(self, mapping: Mapping[AnyKeyT, EncodableT]) -> ResponseT:
"""
Sets key/values based on a mapping if none of the keys are already set.
Expand Down