Skip to content

Commit 7f706de

Browse files
committed
Merge with variadic branch
1 parent 82aa158 commit 7f706de

File tree

1 file changed

+120
-62
lines changed

1 file changed

+120
-62
lines changed

redisphp.php

+120-62
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 = null, $valueN = null ) {}
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 = null, $valueN = null ) {}
470482

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

830842

831843
/**
832-
* Adds a value to the set value stored at key. If this value is already in the set, FALSE is returned.
844+
* Adds a values to the set value stored at key. If this value is already in the set, FALSE is returned.
833845
*
834-
* @param string $key
835-
* @param string $value
836-
* @return bool TRUE if value didn't exist and was added successfully, FALSE if the value is already present.
846+
* @param string $key Required key
847+
* @param string $value1 Required value
848+
* @param string $value2 Optional value
849+
* @param string $valueN Optional value
850+
* @return int Number of value added
837851
* @link http://redis.io/commands/sadd
838852
* @example
839853
* <pre>
840-
* $redis->sAdd('key1' , 'set1'); // TRUE, 'key1' => {'set1'}
841-
* $redis->sAdd('key1' , 'set2'); // TRUE, 'key1' => {'set1', 'set2'}
842-
* $redis->sAdd('key1' , 'set2'); // FALSE, 'key1' => {'set1', 'set2'}
854+
* $redis->sAdd('k', 'v1'); // int(1)
855+
* $redis->sAdd('k', 'v1', 'v2', 'v3'); // int(2)
843856
* </pre>
844857
*/
845-
public function sAdd( $key, $value ) {}
858+
public function sAdd( $key, $value1, $value2 = null, $valueN = null ) {}
846859

847860

848861
/**
849-
* Removes the specified member from the set value stored at key.
862+
* Removes the specified members from the set value stored at key.
850863
*
851864
* @param string $key
852-
* @param string $member
853-
* @return bool TRUE if the member was present in the set, FALSE if it didn't.
865+
* @param string $member1
866+
* @param string $member2
867+
* @param string $memberN
868+
* @return int Number of deleted values
854869
* @link http://redis.io/commands/srem
855870
* @example
856871
* <pre>
857-
* $redis->sAdd('key1' , 'set1');
858-
* $redis->sAdd('key1' , 'set2');
859-
* $redis->sAdd('key1' , 'set3'); // 'key1' => {'set1', 'set2', 'set3'}
860-
* $redis->sRem('key1', 'set2'); // 'key1' => {'set1', 'set3'}
872+
* var_dump( $redis->sAdd('k', 'v1', 'v2', 'v3') ); // int(3)
873+
* var_dump( $redis->sRem('k', 'v2', 'v3') ); // int(2)
874+
* var_dump( $redis->sMembers('k') );
875+
* //// Output:
876+
* // array(1) {
877+
* // [0]=> string(2) "v1"
878+
* // }
861879
* </pre>
862880
*/
863-
public function sRem( $key, $member ) {}
881+
public function sRem( $key, $member1, $member2 = null, $memberN = null ) {}
864882

865883
/**
866884
* @see sRem()
867885
* @link http://redis.io/commands/srem
868886
* @param string $key
869-
* @param int $member
887+
* @param string $member1
888+
* @param string $member2
889+
* @param string $memberN
870890
*/
871-
public function sRemove( $key, $member ) {}
891+
public function sRemove( $key, $member1, $member2 = null, $memberN = null ) {}
872892

873893

874894
/**
@@ -1874,20 +1894,30 @@ public function brpoplpush( $srcKey, $dstKey, $timeout ) {}
18741894
/**
18751895
* Adds the specified member with a given score to the sorted set stored at key.
18761896
*
1877-
* @param string $key
1878-
* @param float $score
1879-
* @param string $value
1880-
* @return int 1 if the element is added. 0 otherwise.
1897+
* @param string $key Required key
1898+
* @param float $score1 Required score
1899+
* @param string $value1 Required value
1900+
* @param float $score2 Optional score
1901+
* @param string $value2 Optional value
1902+
* @param float $scoreN Optional score
1903+
* @param string $valueN Optional value
1904+
* @return int Number of values added
18811905
* @link http://redis.io/commands/zadd
18821906
* @example
18831907
* <pre>
1884-
* $redis->zAdd('key', 1, 'val1');
1885-
* $redis->zAdd('key', 0, 'val0');
1886-
* $redis->zAdd('key', 5, 'val5');
1887-
* $redis->zRange('key', 0, -1); // array(val0, val1, val5)
1908+
* <pre>
1909+
* $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
1910+
* $redis->zRem('z', 'v2', 'v3'); // int(2)
1911+
* var_dump( $redis->zRange('z', 0, -1) );
1912+
* //// Output:
1913+
* // array(2) {
1914+
* // [0]=> string(2) "v1"
1915+
* // [1]=> string(2) "v4"
1916+
* // }
1917+
* </pre>
18881918
* </pre>
18891919
*/
1890-
public function zAdd( $key, $score, $value ) {}
1920+
public function zAdd( $key, $score1, $value1, $score2 = null, $value2 = null, $scoreN = null, $valueN = null ) {}
18911921

18921922
/**
18931923
* Returns a range of elements from the ordered set stored at the specified key,
@@ -1913,33 +1943,40 @@ public function zAdd( $key, $score, $value ) {}
19131943
* $redis->zRange('key1', 0, -1, true); // array('val0' => 0, 'val2' => 2, 'val10' => 10)
19141944
* </pre>
19151945
*/
1916-
public function zRange( $key, $start, $end, $withscores = false ) {}
1946+
public function zRange( $key, $start, $end, $withscores = null ) {}
19171947

19181948
/**
19191949
* Deletes a specified member from the ordered set.
19201950
*
19211951
* @param string $key
1922-
* @param string $member
1923-
* @return int 1 on success, 0 on failure.
1952+
* @param string $member1
1953+
* @param string $member2
1954+
* @param string $memberN
1955+
* @return int Number of deleted values
19241956
* @link http://redis.io/commands/zrem
19251957
* @example
19261958
* <pre>
1927-
* $redis->zAdd('key', 0, 'val0');
1928-
* $redis->zAdd('key', 2, 'val2');
1929-
* $redis->zAdd('key', 10, 'val10');
1930-
* $redis->zDelete('key', 'val2');
1931-
* $redis->zRange('key', 0, -1); // array('val0', 'val10')
1959+
* $redis->zAdd('z', 1, 'v2', 2, 'v2', 3, 'v3', 4, 'v4' ); // int(2)
1960+
* $redis->zRem('z', 'v2', 'v3'); // int(2)
1961+
* var_dump( $redis->zRange('z', 0, -1) );
1962+
* //// Output:
1963+
* // array(2) {
1964+
* // [0]=> string(2) "v1"
1965+
* // [1]=> string(2) "v4"
1966+
* // }
19321967
* </pre>
19331968
*/
1934-
public function zRem( $key, $member ) {}
1969+
public function zRem( $key, $member1, $member2 = null, $memberN = null ) {}
19351970

19361971
/**
19371972
* @see zRem()
1938-
* @param string $key
1939-
* @param string $member
1973+
* @param string $key
1974+
* @param string $member1
1975+
* @param string $member2
1976+
* @param string $memberN
19401977
* @link http://redis.io/commands/zrem
19411978
*/
1942-
public function zDelete( $key, $member ) {}
1979+
public function zDelete( $key, $member1, $member2 = null, $memberN = null ) {}
19431980

19441981
/**
19451982
* Returns the elements of the sorted set stored at the specified key in the range [start, end]
@@ -1966,7 +2003,7 @@ public function zDelete( $key, $member ) {}
19662003
* $redis->zRevRange('key', 0, -1, true); // array('val10' => 10, 'val2' => 2, 'val0' => 0)
19672004
* </pre>
19682005
*/
1969-
public function zRevRange( $key, $start, $end, $withscore = false ) {}
2006+
public function zRevRange( $key, $start, $end, $withscore = null ) {}
19702007

19712008
/**
19722009
* Returns the elements of the sorted set stored at the specified key which have scores in the
@@ -2200,7 +2237,7 @@ public function zIncrBy( $key, $value, $member ) {}
22002237
* $redis->zUnion('ko3', array('k1', 'k2'), array(5, 1)); // 4, 'ko1' => array('val0', 'val2', 'val3', 'val1')
22012238
* </pre>
22022239
*/
2203-
public function zUnion( $Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM' ) {}
2240+
public function zUnion($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {}
22042241

22052242
/**
22062243
* Creates an intersection of sorted sets given in second argument.
@@ -2243,7 +2280,7 @@ public function zUnion( $Output, $ZSetKeys, array $Weights = null, $aggregateFun
22432280
* $redis->zInter('ko4', array('k1', 'k2'), array(1, 5), 'max'); // 2, 'ko4' => array('val3', 'val1')
22442281
* </pre>
22452282
*/
2246-
public function zInter( $Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM' ) {}
2283+
public function zInter($Output, $ZSetKeys, array $Weights = null, $aggregateFunction = 'SUM') {}
22472284

22482285
/**
22492286
* Adds a value to the hash stored at key. If this value is already in the hash, FALSE is returned.
@@ -2313,15 +2350,36 @@ public function hGet($key, $hashKey) {}
23132350
public function hLen( $key ) {}
23142351

23152352
/**
2316-
* Removes a value from the hash stored at key.
2353+
* Removes a values from the hash stored at key.
23172354
* If the hash table doesn't exist, or the key doesn't exist, FALSE is returned.
23182355
*
23192356
* @param string $key
2320-
* @param string $hashKey
2357+
* @param string $hashKey1
2358+
* @param string $hashKey2
2359+
* @param string $hashKeyN
2360+
* @return int Number of deleted fields
23212361
* @link http://redis.io/commands/hdel
2322-
* @return bool TRUE in case of success, FALSE in case of failure
2362+
* @example
2363+
* <pre>
2364+
* $redis->hMSet('h',
2365+
* array(
2366+
* 'f1' => 'v1',
2367+
* 'f2' => 'v2',
2368+
* 'f3' => 'v3',
2369+
* 'f4' => 'v4',
2370+
* ));
2371+
*
2372+
* var_dump( $redis->hDel('h', 'f1') ); // int(1)
2373+
* var_dump( $redis->hDel('h', 'f2', 'f3') ); // int(2)
2374+
* s
2375+
* var_dump( $redis->hGetAll('h') );
2376+
* //// Output:
2377+
* // array(1) {
2378+
* // ["f4"]=> string(2) "v4"
2379+
* // }
2380+
* </pre>
23232381
*/
2324-
public function hDel( $key, $hashKey ) {}
2382+
public function hDel( $key, $hashKey1, $hashKey2 = null, $hashKeyN = null ) {}
23252383

23262384
/**
23272385
* Returns the keys in a hash, as an array of strings.

0 commit comments

Comments
 (0)