Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问有类似redis的list结构吗,我想多进程处理,pop一个元素出来 #2

Closed
popfaker opened this issue Apr 17, 2024 · 3 comments
Labels
question Further information is requested

Comments

@popfaker
Copy link

请问有类似redis的list结构吗,我想多进程处理,pop一个元素出来进行处理,这样利用pop的原子性,多进程获取就不会冲突。看手册不支持,可能需要一下这种操作了,不知道是否可行,或者有性能上的问题

$key = null;
$result = \Workbunny\WebmanSharedCache\Cache::Atomic('lock-test', function () use(&$key){ 
  $key = \Workbunny\WebmanSharedCache\Cache::HKeys('lists')[0];
  \Workbunny\WebmanSharedCache\Cache::HDEL('list', $key);
});

// do sometings by key
// ......

@chaz6chez
Copy link
Member

你的实现上没有问题

@chaz6chez chaz6chez added the question Further information is requested label Apr 22, 2024
@popfaker
Copy link
Author

你的实现上没有问题

感谢

@chaz6chez
Copy link
Member

你的实现上没有问题

感谢

Hash相关的方法其实就是用Atomic+Get+Set来实现的,因为底层apcu可以接受php的各种数据类型,基于这个你可以拓展更多的结构

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants