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);
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30265-2b46b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30265-2b46b.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?