PHP Class Stiphle\Throttle\TimeWindow

Author: Dave Marshall ([email protected])
Inheritance: implements Stiphle\Throttle\ThrottleInterface
Afficher le fichier Open project: davedevelopment/stiphle

Protected Properties

Свойство Type Description
$storage Stiphle\Storage\StorageInterface

Méthodes publiques

Méthode Description
__construct ( )
getEstimate ( string $key, integer $limit, integer $milliseconds ) : integer Get Estimate (doesn't require lock)
setStorage ( Stiphle\Storage\StorageInterface $storage ) : LeakyBucket Set Storage
throttle ( string $key, integer $limit, integer $milliseconds ) : void Throttle

Méthodes protégées

Méthode Description
getStorageKey ( string $key, integer $limit, integer $milliseconds ) : string Get storage key

Method Details

__construct() public méthode

public __construct ( )

getEstimate() public méthode

How long would I have to wait to make a request?
public getEstimate ( string $key, integer $limit, integer $milliseconds ) : integer
$key string - A unique key for what we're throttling
$limit integer - How many are allowed
$milliseconds integer - In this many milliseconds
Résultat integer - the number of milliseconds before this request should be allowed to pass

getStorageKey() protected méthode

Get storage key
protected getStorageKey ( string $key, integer $limit, integer $milliseconds ) : string
$key string - A unique key for what we're throttling
$limit integer - How many are allowed
$milliseconds integer - In this many milliseconds
Résultat string

setStorage() public méthode

Set Storage
public setStorage ( Stiphle\Storage\StorageInterface $storage ) : LeakyBucket
$storage Stiphle\Storage\StorageInterface
Résultat LeakyBucket

throttle() public méthode

Throttle
public throttle ( string $key, integer $limit, integer $milliseconds ) : void
$key string - A unique key for what we're throttling
$limit integer - How many are allowed
$milliseconds integer - In this many milliseconds
Résultat void

Property Details

$storage protected_oe property

protected StorageInterface,Stiphle\Storage $storage
Résultat Stiphle\Storage\StorageInterface