Skip to content

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

@popfaker

Description

@popfaker

请问有类似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
// ......

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions