Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i upsert (replace) operation in Redis? (as Pipelined)

Tags:

redis

upsert

Upsert (Replace)

  • Update If Exists
  • Insert If Not Exists

(Using Primary Key as Pipelined)

like image 217
Serhat Dincel Avatar asked May 10 '11 13:05

Serhat Dincel


People also ask

Does Redis set overwrite?

Description. Redis SET command is used to set some string value in redis key. If the key already holds a value, it is overwritten, regardless of its type. Any previous time to live associated with the key is discarded on a successful SET operation.

Does Redis allow duplicate keys?

You can use the DUMP and RESTORE commands to duplicate the key: use the DUMP command to serialize the value of a key. use the RESTORE command to restore the serialized value to another key.

How many writes per second can Redis handle?

Scaling Your Workload ElastiCache for Redis cluster provides the ability to add and remove shards from a running cluster. Supporting up to 250 nodes and shards, you can scale up to 155.17 TiB (170.6 TB) of in-memory data with 48.6 million reads and 9.7 million writes per second.


1 Answers

What do you mean by "update if exists"? The standard Redis SET commands (SET, MSET, HSET, LSET, etc.) will update (overwrite) an existing key if the key already exists or insert a new key if the key doesn't already exist.

Sounds like you are asking for the default behavior.

like image 78
Carl Zulauf Avatar answered Oct 27 '22 01:10

Carl Zulauf