Can the method redis- > lPush get the return value?

Can the

redis- > lPush method get a return value?
printed it and seemed to have nothing

             $id = $this->post("id");
             $info = $this->PushModel->getPush($id);

             if(empty($info)){
                 $this->json(Constant::FAILURE);
             }

             $gameId = $info["game_id"];
             $title = $info["title"];
             $content = $info["content"];
             $pushInfo = "$id|$gameId|$title|$content";

             $redis = $this->redis();
             $ret = $redis->connect(REDIS_HOST, ZGH_REDIS_PORT);

             $res = $redis->lPush(REDIS_HRGAME_PUSH_BATCH_KEY,$pushInfo);

             print_r($ret);
             print_r($res);exit;

             
Mar.15,2021

if you are using redis, directly instead of php-redis, you will get the length of the current list according to https://redis.io/commands/lpush
Return: the length of the list after the push operations,

redis> LPUSH mylist "world"
(integer) 1
redis> LPUSH mylist "hello"
(integer) 2

if you are using php's redis extension library, php-redis, will get the same result, and you will get the length of the current list

$redis->delete('key1');
$redis->lPush('key1', 'C'); // returns 1
$redis->lPush('key1', 'B'); // returns 2
$redis->lPush('key1', 'A'); // returns 3
/* key1 now points to the following list: [ 'A', 'B', 'C' ] */

if you really don't get the relevant value, you might as well post your relevant code

The

Redis Lpush command inserts one or more values into the list header. You will get the number of data under the current key


generally speaking, an integer value, that is, the length of the list, should be returned. If there is nothing, I suggest you:

try {
    $redis->lPush();
} catch(\Exception $e) {
    var_dump(':' . $e->getMessage);
} catch(\Error $e) {
    var_dump(':' . $e->getMessage);
}
Menu