search

Home  >  Q&A  >  body text

redis List 并发问题

现在c端单线程rpush数据到redis ,我java端用的是hiredis client,能否多线程lpop数据,多线程lpop是否会出现重复pop到同一个数据啊?

天蓬老师天蓬老师2796 days ago673

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-04-24 09:14:21

    Redis is single-threaded, that is, the server side is single-threaded to handle all client requests, so your multiple client requests are executed serially one by one.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-24 09:14:21

    Obviously not. pop is an atomic operation.

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-24 09:14:21

    There is blpop.

    reply
    0
  • Cancelreply