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
Show file Open project: bandwidth-throttle/token-bucket

Public Methods

Method 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

Method 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 method

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 method

public bootstrap ( $microtime )

getMicrotime() public method

public getMicrotime ( )

getMutex() public method

public getMutex ( )

isBootstrapped() public method

public isBootstrapped ( )

remove() public method

public remove ( )

setMicrotime() public method

public setMicrotime ( $microtime )