How does the PHP page cache solve the concurrency problem?

Source: Internet
Author: User
I don't use frames. Read a lot of information, are generated a static file put there, and then expired on the regeneration, not expired directly read the contents of this file, but in case of large concurrent access, because I this is an online room list, is every minute with the new, the number of visits is also very large.

Now there are 2 questions.

1. If a person comes to the access, this file is generated, will not happen to read empty situation?

2. I read the manual file_put_contents method, you can lock "lock_ex in writing to obtain an exclusive lock", I should add this parameter, but the problem is, suppose a person to access, just in the generation also added a lock, he will wait until the unlock to read again, or will be error?

Ask God for answers, thank you very much.


Reply to discussion (solution)

1, yes, no lock will happen to read empty or incomplete situation
2, will not wait to unlock and then go to read, so you need to complete several attempts to open the algorithm

Timing generation is simple, but it's too passive.
The cache generation should be completed immediately when the data is changed

1, yes, no lock will happen to read empty or incomplete situation
2, will not wait to unlock and then go to read, so you need to complete several attempts to open the algorithm

Timing generation is simple, but it's too passive.
The cache generation should be completed immediately when the data is changed

Thanks so much.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.