我如何将数组存储在 Redis 中并使用 PHP 中的 redis 检索数组项

How I can store the array in Redis and retrive the array items using redis in PHP

我有以下 PHP 数组,我想将它存储在 Redis 中。此外,我想在需要执行操作时检索所有数组项。我怎样才能做到这一点。请帮忙

以下是我的 PHP/redis 代码:

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

将其序列化以存储并在检索后反序列化。 Redis简单的存储一个文件。

为了使其不可知,将其编码为 json:

json_encode($yourArray);

检索:

$yourData = json_decode($redisStoradeValue);