@@ -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 /**
0 commit comments