Home  >  Article  >  Backend Development  >  PHP extension PHPredis gets data and returns data similar to :1

PHP extension PHPredis gets data and returns data similar to :1

WBOY
WBOYOriginal
2016-12-05 13:44:061271browse

As mentioned, the project uses the list queue of redis. When using rpop to obtain data, sometimes a value similar to :1 will be returned; the transmission was found in the issues list of phpredis on github Gate, the version used by the project is version 2.2.7. Is there any solution to similar problems?

Reply content:

As mentioned, the project uses the list queue of redis. When using rpop to obtain data, sometimes a value similar to :1 will be returned; the transmission was found in the issues list of phpredis on github Gate, the version used by the project is version 2.2.7. Is there any solution to similar problems?

Upload the code

<code>while (true)
        {
            $list = $redis->blpop(DXKey::getKeyOfRunnerEmailTaskListPending(), 6);
            
            if (is_array($list) && count($list) == 2)
            {
                DXUtil::consoleLog(DXUtil::jsonEncode($list));
                $payload = $list[1];
                DXUtil::consoleLog('pop: ' . $payload);
                $task = @json_decode($payload, true);
                MailTaskRunner::runEmailTask($task);
            }
           
        }</code>

Execution results

<code>2016-11-23 19:23:07 start
2016-11-23 19:23:08 ["runner.email.task.list.pending","{\"time\":1479900188,\"type\":1,\"data\":{\"to_address\":\"wqcsimple@foxmail.com\",\"task_id\":1}}"]
2016-11-23 19:23:08 pop: {"time":1479900188,"type":1,"data":{"to_address":"wqcsimple@foxmail.com","task_id":1}}
2016-11-23 19:23:08 send success
</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn