开发者

how do I delay or control queries?

I planning to release an Api for 开发者_Go百科public. what I am looking into is since it is free I need to control the usage. there are couple of options in my mind. one is delay number of queries per second. second one is fix queries to certain number per day. but second option seems to do more work on scripting which I am planning to avoid now.

so my question is how can I delay number of queries per second limit to 2 and rest put in Queue.

I am working on php so the same script would be appreciated.

or else any other suggestions welcome


You can use php's sleep function to hold the execution in terms of time.

$query = "....................";

// wait for 10 seconds
sleep(10);

// Then execute
$result = mysql_query($query);

//queue other queries in the same way


Why don't you use cron for time/resource critical queries? You can fine-tune your settings at anytime to fit your needs at the best.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜