I am writing a long action controller. In JavaScript, with the help of setInterval, a php script is run once a second, which performs some actions. The running time of this script is 1-3 seconds, after completion the next step should work. I want to prevent the simultaneous launch of two instances of the script.
I tried to write the busy parameter to the session, and then read it. Did not work out. I always get the same from the cache.
After that I decided to save the file in a certain place and then check its availability. If there is a file, then the script is busy, if deleted, it is free. The work of this script does not imply multi-user use, so this option would be quite possible if caching did not come out again.
Tried to check clearstatcache () or even clearstatcache (true, $ temp_file) before checking file_exist (). Did not help. Now I do not even know what to do. It seems to be a simple little problem, but this is not solved in the forehead.