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

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

WBOY
Release: 2023-03-03 08:08:02
Original
1338 people have browsed it

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>
Copy after login

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template