Skip to content

Commit f15950f

Browse files
committed
Updated description to variadic commands: SADD, HDEL, SREM, ZREM, ZADD, LPUSH / RLPUSH
1 parent 1f043e8 commit f15950f

File tree

1 file changed

+116
-61
lines changed

1 file changed

+116
-61
lines changed

redisphp.php

Lines changed: 116 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -431,42 +431,54 @@ public function decrBy($key, $value) {}
431431
public function getMultiple(array $keys) {}
432432

433433
/**
434-
* Adds the string value to the head (left) of the list. Creates the list if the key didn't exist.
434+
* Adds the string values to the head (left) of the list. Creates the list if the key didn't exist.
435435
* If the key exists and is not a list, FALSE is returned.
436436
*
437437
* @param string $key
438-
* @param string $value String, value to push in key
438+
* @param string $value1 String, value to push in key
439+
* @param string $value2 Optional
440+
* @param string $valueN Optional
439441
* @return int The new length of the list in case of success, FALSE in case of Failure.
440442
* @link http://redis.io/commands/lpush
441443
* @example
442444
* <pre>
443-
* $redis->delete('key1');
444-
* $redis->lPush('key1', 'C'); // returns 1
445-
* $redis->lPush('key1', 'B'); // returns 2
446-
* $redis->lPush('key1', 'A'); // returns 3
447-
* // key1 now points to the following list: [ 'A', 'B', 'C' ]
445+
* $redis->lPush('l', 'v1', 'v2', 'v3', 'v4') // int(4)
446+
* var_dump( $redis->lRange('l', 0, -1) );
447+
* //// Output:
448+
* // array(4) {
449+
* // [0]=> string(2) "v4"
450+
* // [1]=> string(2) "v3"
451+
* // [2]=> string(2) "v2"
452+
* // [3]=> string(2) "v1"
453+
* // }
448454
* </pre>
449455
*/
450-
public function lPush($key, $value) {}
456+
public function lPush( $key, $value1, $value2, $valueN ) {}
451457

452458
/**
453-
* Adds the string value to the tail (right) of the list. Creates the list if the key didn't exist.
459+
* Adds the string values to the tail (right) of the list. Creates the list if the key didn't exist.
454460
* If the key exists and is not a list, FALSE is returned.
455461
*
456462
* @param string $key
457-
* @param string $value String, value to push in key
463+
* @param string $value1 String, value to push in key
464+
* @param string $value2 Optional
465+
* @param string $valueN Optional
458466
* @return int The new length of the list in case of success, FALSE in case of Failure.
459467
* @link http://redis.io/commands/rpush
460468
* @example
461469
* <pre>
462-
* $redis->delete('key1');
463-
* $redis->rPush('key1', 'A'); // returns 1
464-
* $redis->rPush('key1', 'B'); // returns 2
465-
* $redis->rPush('key1', 'C'); // returns 3
466-
* // key1 now points to the following list: [ 'A', 'B', 'C' ]
470+
* $redis->rPush('l', 'v1', 'v2', 'v3', 'v4'); // int(4)
471+
* var_dump( $redis->lRange('l', 0, -1) );
472+
* //// Output:
473+
* // array(4) {
474+
* // [0]=> string(2) "v1"
475+
* // [1]=> string(2) "v2"
476+
* // [2]=> string(2) "v3"
477+
* // [3]=> string(2) "v4"
478+
* // }
467479
* </pre>
468480
*/
469-
public function rPush($key, $value) {}
481+
public function rPush( $key, $value1, $value2, $valueN ) {}
470482

471483
/**
472484
* Adds the string value to the head (left) of the list if the list exists.
@@ -821,46 +833,54 @@ public function lInsert($key, $position, $pivot, $value) {}
821833

822834

823835
/**
824-
* Adds a value to the set value stored at key. If this value is already in the set, FALSE is returned.
836+
* Adds a values to the set value stored at key. If this value is already in the set, FALSE is returned.
825837
*
826-
* @param string $key
827-
* @param string $value
828-
* @return bool TRUE if value didn't exist and was added successfully, FALSE if the value is already present.
838+
* @param string $key Required key
839+
* @param string $value1 Required value
840+
* @param string $value2 Optional value
841+
* @param string $valueN Optional value
842+
* @return int Number of value added
829843
* @link http://redis.io/commands/sadd
830844
* @example
831845
* <pre>
832-
* $redis->sAdd('key1' , 'set1'); // TRUE, 'key1' => {'set1'}
833-
* $redis->sAdd('key1' , 'set2'); // TRUE, 'key1' => {'set1', 'set2'}
834-
* $redis->sAdd('key1' , 'set2'); // FALSE, 'key1' => {'set1', 'set2'}
846+
* $redis->sAdd('k', 'v1'); // int(1)
847+
* $redis->sAdd('k', 'v1', 'v2', 'v3'); // int(2)
835848
* </pre>
836849
*/
837-
public function sAdd($key, $value) {}
850+
public function sAdd( $key, $value1, $value2, $valueN ) {}
838851

839852

840853
/**
841-
* Removes the specified member from the set value stored at key.
854+
* Removes the specified members from the set value stored at key.
842855
*
843856
* @param string $key
844-
* @param string $member
845-
* @return bool TRUE if the member was present in the set, FALSE if it didn't.
857+
* @param string $member1
858+
* @param string $member2
859+
* @param string $memberN
860+
* @return int Number of deleted values
846861
* @link http://redis.io/commands/srem
847862
* @example
848863
* <pre>
849-
* $redis->sAdd('key1' , 'set1');
850-
* $redis->sAdd('key1' , 'set2');
851-
* $redis->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
852-
* $redis->sRem('key1', 'set2'); // 'key1' => {'set1', 'set3'}
864+
* var_dump( $redis->sAdd('k', 'v1', 'v2', 'v3') ); // int(3)
865+
* var_dump( $redis->sRem('k', 'v2', 'v3') ); // int(2)
866+
* var_dump( $redis->sMembers('k') );
867+
* //// Output:
868+
* // array(1) {
869+
* // [0]=> string(2) "v1"
870+
* // }
853871
* </pre>
854872
*/
855-
public function sRem($key, $member) {}
873+
public function sRem($key, $member1, $member2, $memberN) {}
856874

857875
/**
858876
* @see sRem()
859877
* @link http://redis.io/commands/srem
860878
* @param string $key
861-
* @param int $member
879+
* @param string $member1
880+
* @param string $member2
881+
* @param string $memberN
862882
*/
863-
public function sRemove($key, $member) {}
883+
public function sRemove($key, $member1, $member2, $memberN) {}
864884

865885

866886
/**
@@ -1837,20 +1857,30 @@ public function brpoplpush($srcKey, $dstKey, $timeout) {}
18371857
/**
18381858
* Adds the specified member with a given score to the sorted set stored at key.
18391859
*
1840-
* @param string $key
1841-
* @param float $score
1842-
* @param string $value
1843-
* @return int 1 if the element is added. 0 otherwise.
1860+
* @param string $key Required key
1861+
* @param float $score1 Required score
1862+
* @param string $value1 Required value
1863+
* @param float $score2 Optional score
1864+
* @param string $value2 Optional value
1865+
* @param float $scoreN Optional score
1866+
* @param string $valueN Optional value
1867+
* @return int Number of values added
18441868
* @link http://redis.io/commands/zadd
18451869
* @example
18461870
* <pre>
1847-
* $redis->zAdd('key', 1, 'val1');
1848-
* $redis->zAdd('key', 0, 'val0');
1849-
* $redis->zAdd('key', 5, 'val5');
1850-
* $redis->zRange('key', 0, -1); // array(val0, val1, val5)
1871+
* <pre>
1872+
* $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
1873+
* $redis->zRem('z', 'v2', 'v3'); // int(2)
1874+
* var_dump( $redis->zRange('z', 0, -1) );
1875+
* //// Output:
1876+
* // array(2) {
1877+
* // [0]=> string(2) "v1"
1878+
* // [1]=> string(2) "v4"
1879+
* // }
1880+
* </pre>
18511881
* </pre>
18521882
*/
1853-
public function zAdd($key, $score, $value) {}
1883+
public function zAdd($key, $score1, $value1, $score2, $value2, $scoreN, $valueN ) {}
18541884

18551885
/**
18561886
* Returns a range of elements from the ordered set stored at the specified key,
@@ -1882,30 +1912,34 @@ public function zRange($key, $start, $end, $withscores = false) {}
18821912
* Deletes a specified member from the ordered set.
18831913
*
18841914
* @param string $key
1885-
* @param string $member
1886-
* @return int 1 on success, 0 on failure.
1915+
* @param string $member1
1916+
* @param string $member2
1917+
* @param string $memberN
1918+
* @return int Number of deleted values
18871919
* @link http://redis.io/commands/zrem
18881920
* @example
18891921
* <pre>
1890-
* $redis->zAdd('key', 0, 'val0');
1891-
* $redis->zAdd('key', 2, 'val2');
1892-
* $redis->zAdd('key', 10, 'val10');
1893-
* $redis->zDelete('key', 'val2');
1894-
* $redis->zRange('key', 0, -1); // array('val0', 'val10')
1922+
* $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
1923+
* $redis->zRem('z', 'v2', 'v3'); // int(2)
1924+
* var_dump( $redis->zRange('z', 0, -1) );
1925+
* //// Output:
1926+
* // array(2) {
1927+
* // [0]=> string(2) "v1"
1928+
* // [1]=> string(2) "v4"
1929+
* // }
18951930
* </pre>
18961931
*/
1897-
public function zRem($key, $member) {}
1932+
public function zRem($key, $member1, $member2, $memberN) {}
18981933

18991934
/**
19001935
* @see zRem()
1901-
* @param string $key
1902-
* @param string $member
1936+
* @param string $key
1937+
* @param string $member1
1938+
* @param string $member2
1939+
* @param string $memberN
19031940
* @link http://redis.io/commands/zrem
19041941
*/
1905-
public function zDelete($key, $member) {}
1906-
1907-
1908-
1942+
public function zDelete($key, $member1, $member2, $memberN) {}
19091943

19101944
/**
19111945
* Returns the elements of the sorted set stored at the specified key in the range [start, end]
@@ -2279,15 +2313,36 @@ public function hGet($key, $hash) {}
22792313
public function hLen($key) {}
22802314

22812315
/**
2282-
* Removes a value from the hash stored at key.
2316+
* Removes a values from the hash stored at key.
22832317
* If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
22842318
*
22852319
* @param string $key
2286-
* @param string $hashKey
2320+
* @param string $hashKey1
2321+
* @param string $hashKey2
2322+
* @param string $hashKeyN
2323+
* @return int Number of deleted fields
22872324
* @link http://redis.io/commands/hdel
2288-
* @return bool TRUE in case of success, FALSE in case of failure
2325+
* @example
2326+
* <pre>
2327+
* $redis->hMSet('h',
2328+
* array(
2329+
* 'f1' => 'v1',
2330+
* 'f2' => 'v2',
2331+
* 'f3' => 'v3',
2332+
* 'f4' => 'v4',
2333+
* ));
2334+
*
2335+
* var_dump( $redis->hDel('h', 'f1') ); // int(1)
2336+
* var_dump( $redis->hDel('h', 'f2', 'f3') ); // int(2)
2337+
* s
2338+
* var_dump( $redis->hGetAll('h') );
2339+
* //// Output:
2340+
* // array(1) {
2341+
* // ["f4"]=> string(2) "v4"
2342+
* // }
2343+
* </pre>
22892344
*/
2290-
public function hDel($key, $hashKey) {}
2345+
public function hDel($key, $hashKey1, $hashKey2, $hashKeyN) {}
22912346

22922347
/**
22932348
* Returns the keys in a hash, as an array of strings.

0 commit comments

Comments
 (0)