redis-pipe | Treat Redis Lists like Unix Pipes
kandi X-RAY | redis-pipe Summary
kandi X-RAY | redis-pipe Summary
Treat Redis Lists like Unix Pipes
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of redis-pipe
redis-pipe Key Features
redis-pipe Examples and Code Snippets
Community Discussions
Trending Discussions on redis-pipe
QUESTION
In redis, I have a hash where I want to first get and then set a value. I reckon I can use pipelining to speed up the whole operation via downsizing the round trips, like so:
...ANSWER
Answered 2018-Mar-21 at 14:50Yes, you can do HGET
and HSET
in the pipeline. However, it behaves slightly different from GETSET
. GETSET
is an atomic operation, but the combination of HGET
and HSET
in a pipeline is NOT atomic.
Redis guarantees that it runs your HGET
command before your HSET
command. However, Redis DOES NOT run these two commands atomically. So when it runs your HSET
command, the HASH
might already be modified by another client. In this case, you do not get the old value, but some older value.
In order to achieve something similar to GETSET
, you have run HGET
and HSET
in a transaction, or wrap these two commands in a Lua
script.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redis-pipe
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page