0

I am pushing data into redis from python like this:

ts  = datetime.datetime.now().timestamp()
if msg.field == 2:
    seq = [ts, 'ask', msg.price]
    r.rpush(contractTuple[0], *seq)

I expect the inserted data (seq) to be one object in redis. However, when I look at the data from the reds-clithe fields of the python list are on separate lines:

127.0.0.1:6379> lrange ES 0 -13

406) "1523994426.496158"
407) "ask"
408) "2699.5"
127.0.0.1:6379>

Is this the way redis-cli displays data (strange if true imo), or am I pushing data into redis incorrectly?

1 Answer 1

1

See: http://redis-py.readthedocs.io/en/latest/index.html#redis.StrictRedis.rpush:

rpush(name, *values)

Push values onto the tail of the list name

Redis doesn't have a concept of "objects". If you want these values to be grouped, you'll have to implement your own methods to (de)serialize them into strings.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.