Using Predis, how to SET (i.e. store) a multidimensional associative array?

后端 未结 1 1087
后悔当初
后悔当初 2021-01-25 01:41

I am following this guide to get started with Predis in PHP. In this guide, they have given the set() function to store key value pairs:

1条回答
  •  囚心锁ツ
    2021-01-25 01:50

    Set method expect value to be string. Use json_encode() to save data.

    $redis->set('allRowsDataArray', json_encode($allRowsDataArray));
    

    And use json_decode() to retrieve from Redis.

    0 讨论(0)
提交回复
热议问题