Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 87fa36d

Browse files
Documentation: Formatting for setOption (#2250)
1 parent 142bddf commit 87fa36d

1 file changed

Lines changed: 54 additions & 101 deletions

File tree

redis.stub.php

Lines changed: 54 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,9 @@ public function brpoplpush(string $src, string $dst, int|float $timeout): Redis|
302302
* POP the maximum scoring element off of one or more sorted sets, blocking up to a specified
303303
* timeout if no elements are available.
304304
*
305-
* @see https://redis.io/commands/bzpopmax
306-
*
307-
* @param string|array $key_or_keys Either a string key or an array of one or more keys.
308-
* @param string|int $timeout_or_key If the previous argument was an array, this argument
309-
* must be a timeout value. Otherwise it could also be
310-
* another key.
311-
* @param mixed $extra_args Can consist of additional keys, until the last argument
312-
* which needs to be a timeout.
313-
*
314305
* Following are examples of the two main ways to call this method.
315306
*
316-
* <code>
307+
* ```php
317308
* <?php
318309
* // Method 1 - Variadic, with the last argument being our timeout
319310
* $redis->bzPopMax('key1', 'key2', 'key3', 1.5);
@@ -325,6 +316,18 @@ public function brpoplpush(string $src, string $dst, int|float $timeout): Redis|
325316
* NOTE: We reccomend calling this function with an array and a timeout as the other strategy
326317
* may be deprecated in future versions of PhpRedis
327318
* ?>
319+
* ```
320+
*
321+
* @see https://redis.io/commands/bzpopmax
322+
*
323+
* @param string|array $key_or_keys Either a string key or an array of one or more keys.
324+
* @param string|int $timeout_or_key If the previous argument was an array, this argument
325+
* must be a timeout value. Otherwise it could also be
326+
* another key.
327+
* @param mixed $extra_args Can consist of additional keys, until the last argument
328+
* which needs to be a timeout.
329+
*
330+
* @return Redis|array|false The popped elements.
328331
*/
329332
public function bzPopMax(string|array $key, string|int $timeout_or_key, mixed ...$extra_args): Redis|array|false;
330333

@@ -2613,31 +2616,6 @@ public function save(): Redis|bool;
26132616
/**
26142617
* Incrementally scan the Redis keyspace, with optional pattern and type matching.
26152618
*
2616-
* @see https://redis.io/commands/scan
2617-
* @see Redis::setOption()
2618-
*
2619-
* @param int $iterator The cursor returned by Redis for every subsequent call to SCAN. On
2620-
* the initial invocation of the call, it should be initialized by the
2621-
* caller to NULL. Each time SCAN is invoked, the iterator will be
2622-
* updated to a new number, until finally Redis will set the value to
2623-
* zero, indicating that the scan is complete.
2624-
*
2625-
* @param string $pattern An optional glob-style pattern for matching key names. If passed as
2626-
* NULL, it is the equivalent of sending '*' (match every key).
2627-
*
2628-
* @param int $count A hint to redis that tells it how many keys to return in a single
2629-
* call to SCAN. The larger the number, the longer Redis may block
2630-
* clients while iterating the key space.
2631-
*
2632-
* @param string $type An optional argument to specify which key types to scan (e.g.
2633-
* 'STRING', 'LIST', 'SET')
2634-
*
2635-
* @return array|false An array of keys, or false if no keys were returned for this
2636-
* invocation of scan. Note that it is possible for Redis to return
2637-
* zero keys before having scanned the entire key space, so the caller
2638-
* should instead continue to SCAN until the iterator reference is
2639-
* returned to zero.
2640-
*
26412619
* A note about Redis::SCAN_NORETRY and Redis::SCAN_RETRY.
26422620
*
26432621
* For convenience, PhpRedis can retry SCAN commands itself when Redis returns an empty array of
@@ -2674,6 +2652,30 @@ public function save(): Redis|bool;
26742652
* }
26752653
* ?>
26762654
* </code>
2655+
* @see https://redis.io/commands/scan
2656+
* @see Redis::setOption()
2657+
*
2658+
* @param int $iterator The cursor returned by Redis for every subsequent call to SCAN. On
2659+
* the initial invocation of the call, it should be initialized by the
2660+
* caller to NULL. Each time SCAN is invoked, the iterator will be
2661+
* updated to a new number, until finally Redis will set the value to
2662+
* zero, indicating that the scan is complete.
2663+
*
2664+
* @param string $pattern An optional glob-style pattern for matching key names. If passed as
2665+
* NULL, it is the equivalent of sending '*' (match every key).
2666+
*
2667+
* @param int $count A hint to redis that tells it how many keys to return in a single
2668+
* call to SCAN. The larger the number, the longer Redis may block
2669+
* clients while iterating the key space.
2670+
*
2671+
* @param string $type An optional argument to specify which key types to scan (e.g.
2672+
* 'STRING', 'LIST', 'SET')
2673+
*
2674+
* @return array|false An array of keys, or false if no keys were returned for this
2675+
* invocation of scan. Note that it is possible for Redis to return
2676+
* zero keys before having scanned the entire key space, so the caller
2677+
* should instead continue to SCAN until the iterator reference is
2678+
* returned to zero.
26772679
*/
26782680
public function scan(?int &$iterator, ?string $pattern = null, int $count = 0, string $type = NULL): array|false;
26792681

@@ -2859,80 +2861,31 @@ public function setRange(string $key, int $index, string $value): Redis|int|fals
28592861
/**
28602862
* Set a configurable option on the Redis object.
28612863
*
2862-
* @see Redis::getOption()
2863-
*
28642864
* Following are a list of options you can set:
28652865
*
2866-
* OPTION TYPE DESCRIPTION
2867-
* OPT_MAX_RETRIES int The maximum number of times Redis will attempt to reconnect
2868-
* if it gets disconnected, before throwing an exception.
2869-
*
2870-
* OPT_SCAN enum Redis::OPT_SCAN_RETRY, or Redis::OPT_SCAN_NORETRY
2871-
*
2872-
* Redis::SCAN_NORETRY (default)
2873-
* --------------------------------------------------------
2874-
* PhpRedis will only call `SCAN` once for every time the
2875-
* user calls Redis::scan(). This means it is possible for
2876-
* an empty array of keys to be returned while there are
2877-
* still more keys to be processed.
2878-
*
2879-
* Redis::SCAN_RETRY
2880-
* --------------------------------------------------------
2881-
* PhpRedis may make multiple calls to `SCAN` for every
2882-
* time the user calls Redis::scan(), and will never return
2883-
* an empty array of keys unless Redis returns the iterator
2884-
* to zero (meaning the `SCAN` is complete).
2885-
*
2886-
*
2887-
* OPT_SERIALIZER int One of the installed serializers, which can vary depending
2888-
* on how PhpRedis was compiled. All of the supported serializers
2889-
* are as follows:
2890-
*
2891-
* Redis::SERIALIZER_NONE
2892-
* Redis::SERIALIZER_PHP
2893-
* Redis::SERIALIZER_IGBINARY
2894-
* Redis::SERIALIZER_MSGPACK
2895-
* Redis::SERIALIZER_JSON
2896-
*
2897-
* Note: The PHP and JSON serializers are always available.
2898-
*
2899-
* OPT_PREFIX string A string PhpRedis will use to prefix every key we read or write.
2900-
* To disable the prefix, you may pass an empty string or NULL.
2901-
*
2902-
* OPT_READ_TIMEOUT double How long PhpRedis will block for a response from Redis before
2903-
* throwing a 'read error on connection' exception.
2904-
*
2905-
* OPT_TCP_KEEPALIVE bool Set or disable TCP_KEEPALIVE on the connection.
2906-
*
2907-
* OPT_COMPRESSION enum Set an automatic compression algorithm to use when reading/writing
2908-
* data to Redis. All of the supported compressors are as follows:
2909-
*
2910-
* Redis::COMPRESSION_NONE
2911-
* Redis::COMPRESSION_LZF
2912-
* Redis::COMPRESSION_LZ4
2913-
* Redis::COMPRESSION_ZSTD
2914-
*
2915-
* Note: Some of these may not be available depending on how Redis
2916-
* was compiled.
2917-
*
2918-
* OPT_REPLY_LITERAL bool If set to true, PhpRedis will return the literal string Redis returns
2919-
* for LINE replies (e.g. '+OK'), rather than `true`.
2920-
*
2921-
* OPT_COMPRESSION_LEVEL int Set a specific compression level if Redis is compressing data.
2922-
*
2923-
* OPT_NULL_MULTIBULK_AS_NULL bool Causes PhpRedis to return `NULL` rather than `false` for NULL MULTIBULK
2924-
* RESP replies (i.e. `*-1`).
2925-
*
2926-
* OPT_BACKOFF_ALGORITHM enum The exponential backoff strategy to use.
2927-
* OPT_BACKOFF_BASE int The minimum delay between retries when backing off.
2928-
* OPT_BACKOFF_CAP int The maximum delay between replies when backing off.
2866+
* | OPTION | TYPE | DESCRIPTION |
2867+
* | --------------- | ---- | ----------- |
2868+
* | OPT_MAX_RETRIES | int | The maximum number of times Redis will attempt to reconnect if it gets disconnected, before throwing an exception. |
2869+
* | OPT_SCAN | enum | Redis::OPT_SCAN_RETRY, or Redis::OPT_SCAN_NORETRY. Whether PhpRedis should automatically SCAN again when zero keys but a nonzero iterator are returned. |
2870+
* | OPT_SERIALIZER | enum | Set the automatic data serializer.<br>`Redis::SERIALIZER_NONE`<br>`Redis::SERIALIZER_PHP`<br>`Redis::SERIALIZER_IGBINARY`<br>`Redis::SERIALIZER_MSGPACK`, `Redis::SERIALIZER_JSON`|
2871+
* | OPT_PREFIX | string | A string PhpRedis will use to prefix every key we read or write. |
2872+
* | OPT_READ_TIMEOUT | float | How long PhpRedis will block for a response from Redis before throwing a 'read error on connection' exception. |
2873+
* | OPT_TCP_KEEPALIVE | bool | Set or disable TCP_KEEPALIVE on the connection. |
2874+
* | OPT_COMPRESSION | enum | Set the compression algorithm<br>`Redis::COMPRESSION_NONE`<br>`Redis::COMPRESSION_LZF`<br>`Redis::COMPRESSION_LZ4`<br> `Redis::COMPRESSION_ZSTD` |
2875+
* | OPT_REPLY_LITERAL | bool | If set to true, PhpRedis will return the literal string Redis returns for LINE replies (e.g. '+OK'), rather than `true`. |
2876+
* | OPT_COMPRESSION_LEVEL | int | Set a specific compression level if Redis is compressing data. |
2877+
* | OPT_NULL_MULTIBULK_AS_NULL | bool | Causes PhpRedis to return `NULL` rather than `false` for NULL MULTIBULK replies |
2878+
* | OPT_BACKOFF_ALGORITHM | enum | The exponential backoff strategy to use. |
2879+
* | OPT_BACKOFF_BASE | int | The minimum delay between retries when backing off. |
2880+
* | OPT_BACKOFF_CAP | int | The maximum delay between replies when backing off. |
29292881
*
2882+
* @see Redis::getOption()
29302883
* @see Redis::__construct() for details about backoff strategies.
29312884
*
29322885
* @param int $option The option constant.
29332886
* @param mixed $value The option value.
29342887
*
2935-
* @return bool True if the setting was updated, false if not.
2888+
* @return bool true if the setting was updated, false if not.
29362889
*
29372890
*/
29382891
public function setOption(int $option, mixed $value): bool;

0 commit comments

Comments
 (0)