PHP Class bandwidthThrottle\tokenBucket\BlockingConsumer

Author: Markus Malkusch ([email protected])
Show file Open project: bandwidth-throttle/token-bucket Class Usage Examples

Public Methods

Method Description
__construct ( TokenBucket $bucket ) Set the token bucket.
consume ( integer $tokens ) Consumes tokens.

Method Details

__construct() public method

Set the token bucket.
public __construct ( TokenBucket $bucket )
$bucket TokenBucket The token bucket.

consume() public method

If the underlying token bucket doesn't have sufficient tokens, the consumer blocks until it can consume the tokens.
public consume ( integer $tokens )
$tokens integer The token amount.