[ACCEPTED]-Batch value insert in Redis list-redis

Accepted answer
Score: 11

You can use a pipeline, if using redis-py 5 you could check out the below, I ran this 4 on an aws instance of redis elasticache 3 and found the following:

import redis
rs = redis.StrictRedis(host='host', port=6379, db=0)

Ran in 0.17s for 2 10,000 vals

def multi_push(q,vals):
    pipe = rs.pipeline()
    for val in vals:

Ran in 13.20s for 10,000 vals

def seq_push(q,vals):
    for val in vals:

~ 78x 1 faster.

Score: 2

Yeah, it doesn't look like that's possible. You 2 might be able to use MULTI (transactions) to 1 store multiple values in an atomic sequence.

Score: 1

You can if you run 2.4. While it isn't marked 5 stable yet, it should be soon IIRC. that 4 said I'm running out of trunk and it's been 3 rock solid for me with many gigs of data 2 and a high rate if churn. For more details 1 on variadic commands see 2.4 and other news.

Score: 1

For lists, not that i am aware of, but depending 7 on your data volume, it might be efficient 6 for you to re-cast your data to use redis' multiset 5 command, HMSET, which does indeed give you 4 multiple inserts in a single call:

HMSET V3620 UnixTime 1309312200 UID 64002 username "doug" level "noob"

As you 3 expect, HMSET creates the redis keyed to 2 V3620. The key follows the HMSET command followed 1 by multiple field--value pairs:

HMSET key field 1 value 1 field 2 value 2

More Related questions