Overview

Namespaces

  • bandwidthThrottle
    • tokenBucket
      • storage
        • scope

Classes

  • FileStorage
  • IPCStorage
  • MemcachedStorage
  • MemcacheStorage
  • PDOStorage
  • PHPRedisStorage
  • PredisStorage
  • SessionStorage
  • SingleProcessStorage

Interfaces

  • Storage

Exceptions

  • StorageException
  • Overview
  • Namespace
  • Class

Class FileStorage

File based storage which can be shared among processes.

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.

bandwidthThrottle\tokenBucket\storage\FileStorage implements bandwidthThrottle\tokenBucket\storage\Storage, bandwidthThrottle\tokenBucket\storage\scope\GlobalScope
Final
Namespace: bandwidthThrottle\tokenBucket\storage
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at storage/FileStorage.php
Methods summary
public
# __construct( string $path )

Sets the file path and opens it.

Sets the file path and opens it.

If the file does not exist yet, it will be created. This is an atomic operation.

Parameters

$path
The file path.

Throws

bandwidthThrottle\tokenBucket\storage\StorageException
Failed to open the file.
public
# setMicrotime( float $microtime )

Parameters

$microtime
The timestamp.

Throws

bandwidthThrottle\tokenBucket\storage\StorageException
Writing to the storage failed.

Suppresswarnings(phpmd)

public float
# getMicrotime( )

Returns

float
The timestamp.

Throws

bandwidthThrottle\tokenBucket\storage\StorageException
Reading from the storage failed.

Suppresswarnings(phpmd)

API documentation generated by ApiGen