phasync\Util\RateLimiter
final
class
Documentation
This class provides an efficient tool for limiting the rate at which events happen, potentially across coroutines.
Example:
phasync::run(function() {
$rateLimiter = new RateLimiter(10);
phasync::go(function() use ($rateLimiter) {
for ($i = 0; $i < 100; $i++) {
$rateLimiter->wait();
echo "This happens 10 times per second\n";
}
});
});
Inheritance
Implements:
phasync\SelectableInterface
Properties (1)
private
phasync\ReadChannelInterface $readChannel
Methods (4)
Documentation missing
Documentation missing
Documentation missing
Blocks the current coroutine if rate limiting is needed.