How to refresh cached files

Source: Internet
Author: User
How to refresh the cache file I wrote a judgment in a loop (when the length of array a is less than 1, it will be executed once) into the cache operation, and vice versa, do not write data into the cache. The result is an incorrect result or the value of array a. It does not change. just how to refresh the cached file?
How to refresh cached files

In a loop, I wrote a judgment statement (once the length of array a is less than 1) into the cache. On the contrary, I did not write it into the cache.

The problem arises here.

When the execution of array a is less than 1, the suffix is saved to B .txt. after that, I read this slow B .txt File (I opened B .txt with the help of the script to get the correct content), and the result is an incorrect response file.

What should I do? To solve this problem.


------ Solution --------------------
No code, no truth
------ Solution --------------------
Did I use fclose before reading it? In addition, I simplified the problem and extracted the code from the project. (The problem is also analyzed.) then I tested it.
------ Solution --------------------
I didn't say so. let's take a look at the cache class first. No one knows how to implement caching.
------ Solution --------------------
The problem does not occur in file read/write. check the entire logic.
Of course, you cannot pass the following test example.
PHP code
File_put_contents ('zzz', 'A'); $ s = file_get_contents ('zzz'); echo $ s; $ fp = fopen ('zzz', 'w '); fwrite ($ fp, 'B'); $ fp = fopen ('zzz', 'r'); echo fgets ($ fp );
------ Solution --------------------
Static method. $ this may be a problem.

Related Article

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.