Documentation

RdbConfig
in package

Configuration for Rdb.

Common properties:

  • host
  • prefix
  • database
  • adapter

Also:

  • object_driver
  • chunk_size
  • scan_size
  • timeout
  • lock_sleep
  • scan_keys
  • options (adapter specific)

Table of Contents

Constants

TTL_AUTO  : mixed = 'auto'
Switch between TTL/PTTL commands if given a int or float, respectively.
TTL_COMPAT  : mixed = 'milliseconds'
Always use PTTL _and_ assume the value is provided as milliseconds.
TTL_FLOAT  : mixed = 'float'
Always use float seconds, the PTTL command.
TTL_INTEGER  : mixed = 'integer'
Always use whole seconds, the TTL command.
TYPE_CREDIS  : mixed = 'credis'
TYPE_PHP_REDIS  : mixed = 'php-redis'
TYPE_PREDIS  : mixed = 'predis'

Properties

$adapter  : string
$chunk_size  : int
$database  : int
$host  : string
$lock_sleep  : float
$object_driver  : RdbObjectDriver>
$options  : array<string|int, mixed>
$prefix  : string
$scan_keys  : bool
Replace keys() with a scan().
$scan_size  : int
$timeout  : int
$ttl_mode  : string
- `TTL_AUTO` use TTL/PTTL based on the value type (int or float, respectively) - `TTL_INTEGER` use TTL only (int) - `TTL_FLOAT` use PTTL only (float) - `TTL_COMPAT` use PTTL (float) and assume the value is provided as milliseconds

Methods

__construct()  : mixed
Create a new config object.
getHost()  : string
Get the hostname.
getPort()  : int
Get the port number from the host.

Constants

TTL_AUTO

Switch between TTL/PTTL commands if given a int or float, respectively.

public mixed TTL_AUTO = 'auto'

Given a float Rdb will multiply by 1000 for the PTTL command.

TTL_COMPAT

Always use PTTL _and_ assume the value is provided as milliseconds.

public mixed TTL_COMPAT = 'milliseconds'

Use this for compatibility with v1/v2 series.

TTL_FLOAT

Always use float seconds, the PTTL command.

public mixed TTL_FLOAT = 'float'

The value is provided in seconds.

TTL_INTEGER

Always use whole seconds, the TTL command.

public mixed TTL_INTEGER = 'integer'

The value is provided in seconds.

TYPE_CREDIS

public mixed TYPE_CREDIS = 'credis'

TYPE_PHP_REDIS

public mixed TYPE_PHP_REDIS = 'php-redis'

TYPE_PREDIS

public mixed TYPE_PREDIS = 'predis'

Properties

$adapter

public string $adapter = self::TYPE_PREDIS

RdbConfig::TYPE

$chunk_size

public int $chunk_size = 50

for mscan and friends (mScanObjects)

$lock_sleep

public float $lock_sleep = 0.005

in seconds

$object_driver

public RdbObjectDriver> $object_driver = \karmabunny\rdb\Objects\PhpObjectDriver::class

$options

public array<string|int, mixed> $options = []

$scan_keys

Replace keys() with a scan().

public bool $scan_keys = false

Warning! It's considerably slower but is a better citizen than keys.

Because redis is single-threaded the iterative scan command helps prevent other clients/connections/requests from blocking up the server.

Using this setting may improve overall responsiveness when the database is under increased load at the cost of immediate performance.

$scan_size

public int $scan_size = 1000

for scan and friends (sscan, hscan, zscan)

$timeout

public int $timeout = 5

in seconds - connection timeout

$ttl_mode

- `TTL_AUTO` use TTL/PTTL based on the value type (int or float, respectively) - `TTL_INTEGER` use TTL only (int) - `TTL_FLOAT` use PTTL only (float) - `TTL_COMPAT` use PTTL (float) and assume the value is provided as milliseconds

public string $ttl_mode = self::TTL_AUTO

RdbConfig::TTL

Methods

__construct()

Create a new config object.

public __construct(iterable<string|int, mixed> $config) : mixed
Parameters
$config : iterable<string|int, mixed>

getHost()

Get the hostname.

public getHost([bool $port = false ]) : string
Parameters
$port : bool = false

Include the port number.

Return values
string

getPort()

Get the port number from the host.

public getPort() : int

Returns the default (6379) otherwise.

Return values
int
On this page

Search results