Laravel can’t get redis key value in For loop

I have a problem with Laravel when getting a Redis value in loop

public function testLoop()
{
    for($i = 0; $i < 3; $i++) {

        Redis::set('key_'.$i, 'value_'.$i);
        Log::info(Redis::get('key_'.$i));
    }
   
    return true;
}

Laravel successfully set the key but any error while trying to get key

here is the logs, it only gets first

[2024-10-21 09:05:13] local.INFO: value_0
[2024-10-21 09:05:13] local.ERROR: Error while reading line from the server. [tcp://docker.for.mac.localhost:6379] {“userId”:569,”exception”:”[object] (PredisConnectionConnectionException(code: 0): Error while reading line from the server. [tcp://docker.for.mac.localhost:6379] at /var/www/html/vendor/predis/predis/src/Connection/AbstractConnection.php:144)
[stacktrace]

and here is the redis key

enter image description here

I’m tried both predis and phpredis but both have same issue

I have set redis timeout to 0

127.0.0.1:6379> config get timeout
1) "timeout"
2) "0"

I’ve also set read_write_timeout in config/database.php to 0

'read_write_timeout' => 0,

value from redis-cli

enter image description here

redis-cli monitor (stuck at key_1)

enter image description here