I have a PHP function that I want to make available publically on the web - but it uses a lot of server resources each time it is called.
What I'd like to happen is that a user who calls this function is forced to wait for some time, before the function is called (or, at the least, before they can call it a second time).
I'd greatly prefer this 'wait' to be enforced on the server-side, so that it can't be overridden by dubious clients. I plan to insist that users log into an online account.
Is there an efficient way I can make the user wait, without using server resources? Would 'sleep()' be an appropriate way to do this? Are there any suggested problems with using sleep()? Is there a better solution to this?
Excuse my ignorance, and thanks!
sleep? Users still can queue up and run several requests simultaneously.