PHP Class bandwidthThrottle\tokenBucket\storage\PDOStorage

This storage is in the global scope.
Author: Markus Malkusch ([email protected])
Inheritance: implements bandwidthThrottle\tokenBucket\storage\Storage, implements bandwidthThrottle\tokenBucket\storage\scope\GlobalScope
Afficher le fichier Open project: bandwidth-throttle/token-bucket

Méthodes publiques

Méthode Description
__construct ( string $name, PDO $pdo ) Sets the PDO and the bucket's name for the shared storage.
bootstrap ( $microtime )
getMicrotime ( )
getMutex ( )
isBootstrapped ( )
remove ( )
setMicrotime ( $microtime )

Private Methods

Méthode Description
forVendor ( array $map, string $default = "" ) : string Returns a vendor specific dialect value.
querySingleValue ( string $sql, array $parameters = [] ) : string Returns one value from a query.

Method Details

__construct() public méthode

The name should be the same for all token buckets which share the same token storage. The transaction isolation level should avoid lost updates, i.e. it should be at least Repeatable Read.
public __construct ( string $name, PDO $pdo )
$name string The name of the token bucket.
$pdo PDO The PDO.

bootstrap() public méthode

public bootstrap ( $microtime )

getMicrotime() public méthode

public getMicrotime ( )

getMutex() public méthode

public getMutex ( )

isBootstrapped() public méthode

public isBootstrapped ( )

remove() public méthode

public remove ( )

setMicrotime() public méthode

public setMicrotime ( $microtime )