ReadPolicy
in package
`ReadPolicy` excapsulates parameters for transaction policy attributes used in all database operation calls.
Table of Contents
Properties
- $exit_fast_on_exhausted_connection_pool : mixed
- $filter_expression : mixed
- $max_retries : mixed
- $read_mode_ap : mixed
- $read_mode_sc : mixed
- $send_key : mixed
- $sleep_multiplier : mixed
- $socket_timeout : mixed
- $total_timeout : mixed
- $use_compression : mixed
Methods
- __construct() : mixed
- getExitFastOnExhaustedConnectionPool() : bool
- ExitFastOnExhaustedConnectionPool determines if a command that tries to get a connection from the connection pool will wait and retry in case the pool is exhausted until a connection becomes available (or the TotalTimeout is reached).
- getFilterExpression() : Expression|null
- FilterExpression is the optional Filter Expression. Supported on Server v5.2+
- getMaxRetries() : int
- MaxRetries determines the maximum number of retries before aborting the current transaction.
- getReadModeAp() : ReadModeAP
- ReadModeAP indicates read policy for AP (availability) namespaces.
- getReadModeSc() : ReadModeSC
- ReadModeSC indicates read policy for SC (strong consistency) namespaces.
- getSendKey() : bool
- SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
- getSleepMultiplier() : float
- SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.
- getSocketTimeout() : int
- SocketTimeout determines network timeout for each attempt.
- getTotalTimeout() : int
- TotalTimeout specifies total transaction timeout.
- getUseCompression() : bool
- UseCompression uses zlib compression on command buffers sent to the server and responses received from the server when the buffer size is greater than 128 bytes.
- setExitFastOnExhaustedConnectionPool() : mixed
- setFilterExpression() : mixed
- setMaxRetries() : mixed
- setReadModeAp() : mixed
- setReadModeSc() : mixed
- setSendKey() : mixed
- setSleepMultiplier() : mixed
- setSocketTimeout() : mixed
- setTotalTimeout() : mixed
- setUseCompression() : mixed
Properties
$exit_fast_on_exhausted_connection_pool
public
mixed
$exit_fast_on_exhausted_connection_pool
$filter_expression
public
mixed
$filter_expression
$max_retries
public
mixed
$max_retries
$read_mode_ap
public
mixed
$read_mode_ap
$read_mode_sc
public
mixed
$read_mode_sc
$send_key
public
mixed
$send_key
$sleep_multiplier
public
mixed
$sleep_multiplier
$socket_timeout
public
mixed
$socket_timeout
$total_timeout
public
mixed
$total_timeout
$use_compression
public
mixed
$use_compression
Methods
__construct()
public
__construct() : mixed
getExitFastOnExhaustedConnectionPool()
ExitFastOnExhaustedConnectionPool determines if a command that tries to get a connection from the connection pool will wait and retry in case the pool is exhausted until a connection becomes available (or the TotalTimeout is reached).
public
getExitFastOnExhaustedConnectionPool() : bool
If set to true, an error will be return immediately. If set to false, getting a connection will be retried. This only applies if LimitConnectionsToQueueSize is set to true and the number of open connections to a node has reached ConnectionQueueSize. The default is false
Return values
boolgetFilterExpression()
FilterExpression is the optional Filter Expression. Supported on Server v5.2+
public
getFilterExpression() : Expression|null
Return values
Expression|nullgetMaxRetries()
MaxRetries determines the maximum number of retries before aborting the current transaction.
public
getMaxRetries() : int
The initial attempt is not counted as a retry.
If MaxRetries is exceeded, the transaction will abort with an error.
WARNING: Database writes that are not idempotent (such as AddOp) should not be retried because the write operation may be performed multiple times if the client timed out previous transaction attempts. It's important to use a distinct WritePolicy for non-idempotent writes which sets maxRetries = 0;
Default for read: 2 (initial attempt + 2 retries = 3 attempts)
Default for write: 0 (no retries)
Default for partition scan or query with nil filter: 5 (6 attempts. See ScanPolicy comments.)
Return values
intgetReadModeAp()
ReadModeAP indicates read policy for AP (availability) namespaces.
public
getReadModeAp() : ReadModeAP
Return values
ReadModeAPgetReadModeSc()
ReadModeSC indicates read policy for SC (strong consistency) namespaces.
public
getReadModeSc() : ReadModeSC
Return values
ReadModeSCgetSendKey()
SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
public
getSendKey() : bool
If the key is sent on a write, the key will be stored with the record on the server. The default is to not send the user defined key.
Return values
boolgetSleepMultiplier()
SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.
public
getSleepMultiplier() : float
Default to (1.0); Only values greater than 1 are valid.
Return values
floatgetSocketTimeout()
SocketTimeout determines network timeout for each attempt.
public
getSocketTimeout() : int
If SocketTimeout is not zero and SocketTimeout is reached before an attempt completes, the Timeout above is checked. If Timeout is not exceeded, the transaction is retried. If both SocketTimeout and Timeout are non-zero, SocketTimeout must be less than or equal to Timeout, otherwise Timeout will also be used for SocketTimeout.
Default: 30s
Return values
intgetTotalTimeout()
TotalTimeout specifies total transaction timeout.
public
getTotalTimeout() : int
The TotalTimeout is tracked on the client and also sent to the server along with the transaction in the wire protocol. The client will most likely timeout first, but the server has the capability to Timeout the transaction.
If TotalTimeout is not zero and TotalTimeout is reached before the transaction completes, the transaction will abort with TotalTimeout error.
If TotalTimeout is zero, there will be no time limit and the transaction will retry on network timeouts/errors until MaxRetries is exceeded. If MaxRetries is exceeded, the transaction also aborts with Timeout error.
Default for scan/query: 0 (no time limit and rely on MaxRetries)
Default for all other commands: 1000ms
Return values
intgetUseCompression()
UseCompression uses zlib compression on command buffers sent to the server and responses received from the server when the buffer size is greater than 128 bytes.
public
getUseCompression() : bool
This option will increase cpu and memory usage (for extra compressed buffers),but decrease the size of data sent over the network.
Default: false
Return values
boolsetExitFastOnExhaustedConnectionPool()
public
setExitFastOnExhaustedConnectionPool(bool $exit_fast_on_exhausted_connection_pool) : mixed
Parameters
- $exit_fast_on_exhausted_connection_pool : bool
setFilterExpression()
public
setFilterExpression(mixed $filter_expression) : mixed
Parameters
- $filter_expression : mixed
setMaxRetries()
public
setMaxRetries(int $max_retries) : mixed
Parameters
- $max_retries : int
setReadModeAp()
public
setReadModeAp(mixed $read_mode_ap) : mixed
Parameters
- $read_mode_ap : mixed
setReadModeSc()
public
setReadModeSc(mixed $read_mode_sc) : mixed
Parameters
- $read_mode_sc : mixed
setSendKey()
public
setSendKey(bool $send_key) : mixed
Parameters
- $send_key : bool
setSleepMultiplier()
public
setSleepMultiplier(float $sleep_multiplier) : mixed
Parameters
- $sleep_multiplier : float
setSocketTimeout()
public
setSocketTimeout(int $timeout_millis) : mixed
Parameters
- $timeout_millis : int
setTotalTimeout()
public
setTotalTimeout(int $timeout_millis) : mixed
Parameters
- $timeout_millis : int
setUseCompression()
public
setUseCompression(bool $use_compression) : mixed
Parameters
- $use_compression : bool