Saving a HASH to Redis on a rails app

后端 未结 4 1374
梦毁少年i
梦毁少年i 2021-02-02 08:36

Im just starting off with Redis with Rails so this maybe a dumb question.

I am trying to save a hash to redis server but when I retrieve it its just a string IE.

4条回答
  •  不知归路
    2021-02-02 09:06

    In order to save a hash in redis. You must pass the key as a first parameter and then the next parameters must be the keys and values on hmset method.

    $redis.hmset('user:007', :name, 'Antonio', :busy, 'maybe', :ping, 'pong')
    

    Happy Coding.

提交回复
热议问题