3
Hello I want to have a control variable where the value of it is read by all customers and thus avoid that the same function is being executed by each client who enters the site.
Example, I have a page that updates the database with information.
If 10 people enter the site, this update will be performed 10 times.
If on the first visitor I can set a variable that can be read by the other visitors in order to prevent the update from being made again would be great.
You can do it?
Could you give an example of how to do that?
– Rodrigo
@Rodrigo added the example for file use
– Miguel Mesquita Alfaiate
Perfect, now I have another question. This is lighter for using server resources than changing a field in a mysql table and query this value for each client that visits the page?
– Rodrigo
@Rodrigo yes, files are lighter and faster than Mysql accesses
– Miguel Mesquita Alfaiate
@Rodrigo Blunt’s answer is correct in generic terms, because the best solution will depend a lot on the server/servers environment that did not indicated in the question.
– chambelix