.net core StackExchange.Redis LPop是否处于发布/订阅的潜在竞争状态?
在使用dotnetcore中的StackExchange.Redis库时,我考虑使用pub/sub功能来实现阻止某些工作类使用消息,如前所述 给出的示例如下:.net core StackExchange.Redis LPop是否处于发布/订阅的潜在竞争状态?,.net-core,redis,stackexchange.redis,.net Core,Redis,Stackexchange.redis,在使用dotnetcore中的StackExchange.Redis库时,我考虑使用pub/sub功能来实现阻止某些工作类使用消息,如前所述 给出的示例如下: sub.Subscribe(channel, delegate { string work = db.ListRightPop(key); if (work != null) Process(work); }); //... db.ListLeftPush(key, newWork, flags: CommandF
sub.Subscribe(channel, delegate {
string work = db.ListRightPop(key);
if (work != null) Process(work);
});
//...
db.ListLeftPush(key, newWork, flags: CommandFlags.FireAndForget);
sub.Publish(channel, "");
如果多个工作者订阅频道
(在分布式系统中,而不是在同一台主机上),那么ListRightPop
是否仍然存在潜在竞争条件,因为它不是Redis群集上的阻塞操作