0

I have following PHP array and I want to store it in Redis. Also I want to retrieve all the array items whenever needed to perform the operation. How can I achieve this. Please help.

Following is my PHP/redis code:

$data['xxx'] = array(
                        'created'           => date("Y-m-d H:i:s"),
                        'tracking_id'       => 'abCd',
                        'affiliate_id'      => 100,
                    );
Ajay Y
  • 17
  • 5

1 Answers1

0

Serialize it to store and unserialize after retrieve. Redis simply store a document.

In order to keep it agnostic, encode it in json:

json_encode($yourArray);

To retrieve:

$yourData = json_decode($redisStoradeValue);
otaviofcs
  • 785
  • 2
  • 6
  • 16