Write multiple hash field across different keys atomically
300 views
Skip to first unread message
Boyang Chen
unread,
Jan 8, 2022, 6:02:42 PM1/8/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Redis DB
Hey there,
I'm new to Redis, and we have a use case to write multiple hash fields in an atomic manner, is that something Redis could add support for? To be specific, hmset doesn't help because I'm trying to write: key A, field x
key B, field y
atomically, not key A, field (x, y)
I know there is transaction support in Redis, but since we don't need RMW, so probably worth getting a standalone API. Let me know what you think.
Viktor Söderqvist
unread,
Jan 9, 2022, 1:01:38 PM1/9/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redi...@googlegroups.com
MULTI
HSET A x hello
HSET B y world
EXEC
The commands can be sent in a pipeline so there is no extra
round-trip. Multi-exec is very fast. It simply queues up the
queries and executes them together.
I think it's very unlikely that Redis will add special command to
write to multiple keys simultaneously.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to redi...@googlegroups.com
Pipeline has nothing to do with transactions.
Pipeline just means that you send multiple commands without waiting for
the reply for the previous commands.
MULTI-(commands)-EXEC is a transaction. You can send one command and
wait for reply before you send the next command, or you can send all
commands at once in a pipeline.
Only HSET a x hello; HSET b y world in a pipeline (without MULTI) is not
a transaction.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Redis DB" group.
> To unsubscribe from this group and stop receiving emails from it, send