PHP Class bandwidthThrottle\tokenBucket\Rate

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

Public Methods

Method Description
__construct ( integer $tokens, string $unit ) Sets the amount of tokens which will be produced per unit.
getTokensPerSecond ( ) : double Returns the rate in Tokens per second.

Method Details

__construct() public method

E.g. new Rate(100, Rate::SECOND) will produce 100 tokens per second.
public __construct ( integer $tokens, string $unit )
$tokens integer positive amount of tokens to produce per unit
$unit string unit as one of Rate's constants

getTokensPerSecond() public method

Returns the rate in Tokens per second.
public getTokensPerSecond ( ) : double
return double The rate.