I Have an array of objects that I need to store into redis cache and use it later.
$obj = array(
'request_id' => $request_id,
'request_start_dttm' => $start_time,
'client_id' => $clientId,
);
$redis = Redis::connection();
$name = "API".bin2hex(random_bytes(3));
$redis->rpush($name,$obj);
print_r($redis->lrange($name,0,-1));
But I get the output as following:
array (
0 => '1732478',
1 => '2021-10-18 12:55:39.000000',
2 => '3'
)
What should I do to preserve the key value pair using redis php?