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

Skip to content

Commit cc2383f

Browse files
Documentation: Additional docblock headers
[skip ci]
1 parent fb3fb6f commit cc2383f

6 files changed

Lines changed: 194 additions & 44 deletions

redis.stub.php

Lines changed: 175 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -437,27 +437,29 @@ public function close(): bool;
437437
public function command(string $opt = null, string|array $arg): mixed;
438438

439439
/**
440-
Execute the Redis CONFIG command in a variety of ways. What the command does in particular depends
441-
on the `$operation` qualifier.
442-
443-
Operations that PhpRedis supports are: RESETSTAT, REWRITE, GET, and SET.
444-
445-
@param string $operation The CONFIG subcommand to execute
446-
@param array|string|null $key_or_setting Can either be a setting string for the GET/SET operation or
447-
an array of settings or settings and values.
448-
Note: Redis 7.0.0 is required to send an array of settings.
449-
@param ?string $value The setting value when the operation is SET.
450-
451-
<code>
452-
<?php
453-
$redis->config('GET', 'timeout');
454-
$redis->config('GET', ['timeout', 'databases']);
455-
456-
$redis->config('SET', 'timeout', 30);
457-
$redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']);
458-
?>
459-
</code>
460-
*/
440+
* Execute the Redis CONFIG command in a variety of ways. What the command does in particular depends
441+
* on the `$operation` qualifier.
442+
*
443+
* Operations that PhpRedis supports are: RESETSTAT, REWRITE, GET, and SET.
444+
*
445+
* @see https://redis.io/commands/config
446+
*
447+
* @param string $operation The CONFIG subcommand to execute
448+
* @param array|string|null $key_or_setting Can either be a setting string for the GET/SET operation or
449+
* an array of settings or settings and values.
450+
* Note: Redis 7.0.0 is required to send an array of settings.
451+
* @param string $value The setting value when the operation is SET.
452+
*
453+
* <code>
454+
* <?php
455+
* $redis->config('GET', 'timeout');
456+
* $redis->config('GET', ['timeout', 'databases']);
457+
*
458+
* $redis->config('SET', 'timeout', 30);
459+
* $redis->config('SET', ['timeout' => 30, 'loglevel' => 'warning']);
460+
* ?>
461+
* </code>
462+
* */
461463
public function config(string $operation, array|string|null $key_or_settings = NULL, ?string $value = NULL): mixed;
462464

463465
public function connect(string $host, int $port = 6379, float $timeout = 0, string $persistent_id = null, int $retry_interval = 0, float $read_timeout = 0, array $context = null): bool;
@@ -545,6 +547,9 @@ public function debug(string $key): Redis|string;
545547
/**
546548
* Decrement a Redis integer by 1 or a provided value.
547549
*
550+
* @see https://redis.io/commands/decr
551+
* @see https://redis.io/commands/decrby
552+
*
548553
* @param string $key The key to decrement
549554
* @param int $by How much to decrement the key. Note that if this value is
550555
* not sent or is set to `1`, PhpRedis will actually invoke
@@ -573,6 +578,8 @@ public function decr(string $key, int $by = 1): Redis|int|false;
573578
/**
574579
* Decrement a redis integer by a value
575580
*
581+
* @see https://redis.io/commands/decrby
582+
*
576583
* @param string $key The integer key to decrement.
577584
* @param int $value How much to decrement the key.
578585
*
@@ -636,6 +643,27 @@ public function discard(): Redis|bool;
636643

637644
public function dump(string $key): Redis|string;
638645

646+
/**
647+
* Have Redis repeat back an arbitrary string to the client.
648+
*
649+
* @see https://redis.io/commands/echo
650+
*
651+
* @param string $str The string to echo
652+
*
653+
* @return Redis|string|false The string sent to Redis or false on failure.
654+
*
655+
* <code>
656+
* <?php
657+
* $redis = new Redis(['host' => 'localhost']);
658+
*
659+
* var_dump($redis->echo('Hello, World'));
660+
*
661+
* // --- OUTPUT ---
662+
* // string(12) "Hello, World"
663+
*
664+
* ?>
665+
* </code>
666+
*/
639667
public function echo(string $str): Redis|string|false;
640668

641669
/**
@@ -686,41 +714,148 @@ public function evalsha(string $sha1, array $args = [], int $num_keys = 0): mixe
686714
*/
687715
public function evalsha_ro(string $sha1, array $args = [], int $num_keys = 0): mixed;
688716

717+
/**
718+
* Execute either a MULTI or PIPELINE block and return the array of replies.
719+
*
720+
* @see https://redis.io/commands/exec
721+
* @see https://redis.io/commands/multi
722+
* @see Redis::pipeline()
723+
* @see Redis::multi()
724+
*
725+
* @return Redis|array|false The array of pipeline'd or multi replies or false on failure.
726+
*
727+
* <code>
728+
* $redis = new Redis(['host' => 'localhost']);
729+
*
730+
* $res = $redis->multi()
731+
* ->set('foo', 'bar')
732+
* ->get('foo')
733+
* ->del('list')
734+
* ->rpush('list', 'one', 'two', 'three')
735+
* ->exec();
736+
*
737+
* var_dump($res);
738+
*
739+
* // --- OUTPUT ---
740+
* // array(4) {
741+
* // [0]=>
742+
* // bool(true) // set('foo', 'bar')
743+
* // [1]=>
744+
* // string(3) "bar" // get('foo')
745+
* // [2]=>
746+
* // int(1) // del('list')
747+
* // [3]=>
748+
* // int(3) // rpush('list', 'one', 'two', 'three')
749+
* // }
750+
* ?>
751+
* </code>
752+
*/
689753
public function exec(): Redis|array|false;
690754

755+
/**
756+
* Test if one or more keys exist.
757+
*
758+
* @see https://redis.io/commands/exists
759+
*
760+
* @param mixed $key Either an array of keys or a string key
761+
* @param mixed $other_keys If the previous argument was a string, you may send any number of
762+
* additional keys to test.
763+
*
764+
* @return Redis|int|bool The number of keys that do exist and false on failure
765+
*
766+
* <code>
767+
* <?php
768+
* $redis = new Redis(['host' => 'localhost']);
769+
*
770+
* $redis->multi()
771+
* ->mset(['k1' => 'v1', 'k2' => 'v2', 'k3' => 'v3', 'k4' => 'v4'])
772+
* ->exec();
773+
*
774+
* // Using a single array of keys
775+
* var_dump($redis->exists(['k1', 'k2', 'k3']));
776+
*
777+
* // Calling via variadic arguments
778+
* var_dump($redis->exists('k4', 'k5', 'notakey'));
779+
*
780+
* // --- OUTPUT ---
781+
* // int(3)
782+
* // int(1)
783+
* ?>
784+
* </code>
785+
*/
691786
public function exists(mixed $key, mixed ...$other_keys): Redis|int|bool;
692787

693788
/**
694-
Sets an expiration in seconds on the key in question. If connected to
695-
redis-server >= 7.0.0 you may send an additional "mode" argument which
696-
modifies how the command will execute.
697-
698-
@param string $key The key to set an expiration on.
699-
@param ?string $mode A two character modifier that changes how the
700-
command works.
701-
NX - Set expiry only if key has no expiry
702-
XX - Set expiry only if key has an expiry
703-
LT - Set expiry only when new expiry is < current expiry
704-
GT - Set expiry only when new expiry is > current expiry
789+
* Sets an expiration in seconds on the key in question. If connected to
790+
* redis-server >= 7.0.0 you may send an additional "mode" argument which
791+
* modifies how the command will execute.
792+
*
793+
* @see https://redis.io/commands/expire
794+
*
795+
* @param string $key The key to set an expiration on.
796+
* @param string $mode A two character modifier that changes how the
797+
* command works.
798+
* NX - Set expiry only if key has no expiry
799+
* XX - Set expiry only if key has an expiry
800+
* LT - Set expiry only when new expiry is < current expiry
801+
* GT - Set expiry only when new expiry is > current expiry
705802
*/
706803
public function expire(string $key, int $timeout, ?string $mode = NULL): Redis|bool;
707804

708805
/**
709-
Set a key's expiration to a specific Unix timestamp in seconds. If
710-
connected to Redis >= 7.0.0 you can pass an optional 'mode' argument.
711-
712-
@see Redis::expire() For a description of the mode argument.
713-
714-
@param string $key The key to set an expiration on.
715-
@param ?string $mode A two character modifier that changes how the
716-
command works.
806+
* Set a key's expiration to a specific Unix timestamp in seconds. If
807+
* connected to Redis >= 7.0.0 you can pass an optional 'mode' argument.
808+
*
809+
* @see Redis::expire() For a description of the mode argument.
810+
*
811+
* @param string $key The key to set an expiration on.
812+
* @param string $mode A two character modifier that changes how the
813+
* command works.
717814
*/
718815
public function expireAt(string $key, int $timestamp, ?string $mode = NULL): Redis|bool;
719816

720817
public function failover(?array $to = null, bool $abort = false, int $timeout = 0): Redis|bool;
721818

819+
/**
820+
* Get the expiration of a given key as a unix timestamp
821+
*
822+
* @see https://redis.io/commands/expiretime
823+
*
824+
* @param string $key The key to check.
825+
*
826+
* @return Redis|int|false The timestamp when the key expires, or -1 if the key has no expiry
827+
* and -2 if the key doesn't exist.
828+
*
829+
* <code>
830+
* <?php
831+
* $redis = new Redis(['host' => 'localhost']);
832+
*
833+
* $redis->set('expiry-key', 'this will last a very long time');
834+
*
835+
* // Expire this key at 2222/02/22 02:22:22 GMT
836+
* $redis->expireAt('expiry-key', 7955144542);
837+
*
838+
* var_dump($redis->expiretime('expiry-key'));
839+
*
840+
* // --- OUTPUT ---
841+
* // int(7955144542)
842+
*
843+
* ?>php
844+
* </code>
845+
*/
722846
public function expiretime(string $key): Redis|int|false;
723847

848+
/**
849+
* Get the expriation timestamp of a given Redis key but in milliseconds.
850+
*
851+
* @see https://redis.io/commands/pexpiretime
852+
* @see Redis::expiretime()
853+
*
854+
* @param string $key The key to check
855+
*
856+
* @return Redis|int|false The expiration timestamp of this key (in milliseconds) or -1 if the
857+
* key has no expiration, and -2 if it does not exist.
858+
*/
724859
public function pexpiretime(string $key): Redis|int|false;
725860

726861
/**

redis_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 1e5a8c3e8d885354e26185e651b0f7ee0dbf8374 */
2+
* Stub hash: d59da775ee203c4ec2f7c5a558e07a561a8a501a */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 0, "null")

redis_cluster.stub.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ public function cluster(string|array $key_or_address, string $command, mixed ...
124124

125125
public function command(mixed ...$extra_args): mixed;
126126

127+
/**
128+
* @see Redis::config()
129+
*/
127130
public function config(string|array $key_or_address, string $subcommand, mixed ...$extra_args): mixed;
128131

129132
/**
@@ -152,6 +155,9 @@ public function discard(): bool;
152155

153156
public function dump(string $key): RedisCluster|string|false;
154157

158+
/**
159+
* @see Redis::echo()
160+
*/
155161
public function echo(string|array $key_or_address, string $msg): RedisCluster|string|false;
156162

157163
public function eval(string $script, array $args = [], int $num_keys = 0): mixed;
@@ -162,6 +168,9 @@ public function evalsha(string $script_sha, array $args = [], int $num_keys = 0)
162168

163169
public function evalsha_ro(string $script_sha, array $args = [], int $num_keys = 0): mixed;
164170

171+
/**
172+
* @see Redis::exec()
173+
*/
165174
public function exec(): array|false;
166175

167176
public function exists(mixed $key, mixed ...$other_keys): RedisCluster|int|bool;
@@ -175,8 +184,14 @@ public function expire(string $key, int $timeout, ?string $mode = NULL): RedisCl
175184

176185
public function expireat(string $key, int $timestamp, ?string $mode = NULL): RedisCluster|bool;
177186

187+
/**
188+
* @see Redis::expiretime()
189+
*/
178190
public function expiretime(string $key): RedisCluster|int|false;
179191

192+
/**
193+
* @see Redis::pexpiretime()
194+
*/
180195
public function pexpiretime(string $key): RedisCluster|int|false;
181196

182197
public function flushall(string|array $key_or_address, bool $async = false): RedisCluster|bool;

redis_cluster_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: fb0623f92a600a7b3cba70d9f3ba82164914f267 */
2+
* Stub hash: 0a5a8d4a59c4d7929402293be13553ffcaee7c7e */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 1)

redis_cluster_legacy_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: fb0623f92a600a7b3cba70d9f3ba82164914f267 */
2+
* Stub hash: 0a5a8d4a59c4d7929402293be13553ffcaee7c7e */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RedisCluster___construct, 0, 0, 1)
55
ZEND_ARG_INFO(0, name)

redis_legacy_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 1e5a8c3e8d885354e26185e651b0f7ee0dbf8374 */
2+
* Stub hash: d59da775ee203c4ec2f7c5a558e07a561a8a501a */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_INFO(0, options)

0 commit comments

Comments
 (0)