PHP Class bandwidthThrottle\tokenBucket\storage\FileStorage

This storage is in the global scope. However the scope is limited to the underlying filesystem. I.e. the scope is not shared between hosts.
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 Class Usage Examples

Public Methods

Method Description
__construct ( string $path ) Sets the file path and opens it.
__destruct ( ) Closes the file handle.
bootstrap ( $microtime )
getMicrotime ( )
getMutex ( )
isBootstrapped ( )
remove ( )
setMicrotime ( $microtime )

Private Methods

Method Description
open ( ) Opens the file and initializes the mutex.

Method Details

__construct() public method

If the file does not exist yet, it will be created. This is an atomic operation.
public __construct ( string $path )
$path string The file path.

__destruct() public method

Closes the file handle.
public __destruct ( )

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 )