search

Home  >  Q&A  >  body text

Can PHP's array_push and array_pop be used instead of redis' list?

When making queues, for example, when queuing for product orders, we use redis' list. I think we can use PHP's array_push and array_pop instead of redis' list?

巴扎黑巴扎黑2751 days ago1129

reply all(4)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-16 13:16:47

    An array cannot exist between multiple requests. When a single request ends, the process ends, resources are released, and the array is destroyed. Data persistence is required

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:16:47

    Obviously not. If you can play like this, there will be no need to cache anything

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-16 13:16:47

    php is a process, it will not exist the next time after one request. Unless you store this array in the database

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-16 13:16:47

    Yes, but you need to use cache to save the status of pushing and popping the stack, because the data of a single user process will not be shared with other users. You need to save it every time it changes. If you don’t need to save it with redis, then use file cache every time. All changes must be saved

    reply
    0
  • Cancelreply