strukt / queue
Memcached 队列
dev-master
2024-01-25 02:20 UTC
Requires
- php: ^8.1
- ext-memcached: *
- strukt/commons: v1.1.1-alpha
This package is not auto-updated.
Last update: 2024-09-20 20:16:31 UTC
README
简单实现消息队列,使用 Memcached https://memcached.org/ 作为后端
需要安装 PHP Memcached 扩展才能正常运行
@author Maurizio Giunti https://www.mauriziogiunti.it / https://codeguru.it
@license MIT
用法
等待
//wait.php $data = ["username"=>"pitsolu", "password"=>"p@55w0rd"]; wait("queue_test", $data, function($reply){ print_r($reply); });
回复
//reply.php reply("queue_test", function($data){ $data["processed"] = true; return $data; });
其他用法
弹出
$data = array( "username"=>"pitsolu", "password"=>"p@55w0rd" ); $uid = push("queue_test", $data);
推送
list($oid, $udata) = pop("queue_test"); print_r(array( "uid"=>$uid, "oid"=>$oid, "data"=>$data, "udata"=>$udata ));