Nadav Stern Nadav Stern - 1 month ago 13
Python Question

Redis pipeline - atomic getting a value of another key value

I have a string key named "a" and its value is "b", I also have a hash set which is named "b" and it has multiple values for example:

"a" (value equals to "b")

"b": {
"first_name": "John",
"last_name": "Doe"


is it possible to use a pipeline so given the key "a" I will receive
the object b value ?



Pipeline is an optimization for sending multiple operations. It doesn't guarantee atomicity and the replies are available only after the pipeline is executed. That being the case, it would appear that it isn't suitable for what you're trying to do.

IIUC, you want to "dereference" the value in the first key and get the data in the second key. I suspect that when you use the term "atomically" your meaning is with one call to the server. That pattern isn't supported by Redis - instead, you should GET the value in a and then HMGET from b.