PHP Class Tolerance\Throttling\RateLimit\LeakyBucket

Inheritance: implements Tolerance\Throttling\RateLimit\RateLimit
Show file Open project: sroze/tolerance Class Usage Examples

Public Methods

Method Description
__construct ( Tolerance\Throttling\RateMeasureStorage\RateMeasureStorage $storage, Tolerance\Throttling\Rate\Rate $rate )
getTicksBeforeUnderLimit ( $identifier )
hasReachedLimit ( $identifier )
tick ( $identifier )

Private Methods

Method Description
computeCurrentRate ( string $identifier ) : float Create the current rate.
getMeasure ( string $identifier ) : Tolerance\Throttling\RateMeasure\RateMeasure

Method Details

__construct() public method

public __construct ( Tolerance\Throttling\RateMeasureStorage\RateMeasureStorage $storage, Tolerance\Throttling\Rate\Rate $rate )
$storage Tolerance\Throttling\RateMeasureStorage\RateMeasureStorage
$rate Tolerance\Throttling\Rate\Rate

getTicksBeforeUnderLimit() public method

public getTicksBeforeUnderLimit ( $identifier )

hasReachedLimit() public method

public hasReachedLimit ( $identifier )

tick() public method

public tick ( $identifier )