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

Skip to content

Commit 6808cd6

Browse files
Fix documentation to show lPush and rPush are variadic. (#1737)
Addresses #1734
1 parent 4ef465b commit 6808cd6

1 file changed

Lines changed: 22 additions & 16 deletions

File tree

README.markdown

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,22 +1923,26 @@ $redis->lPop('key1'); /* key1 => [ 'B', 'C' ] */
19231923

19241924
### lPush
19251925
-----
1926-
_**Description**_: Adds the string value to the head (left) of the list. Creates the list if the key didn't exist. If the key exists and is not a list, `FALSE` is returned.
1926+
_**Description**_: Adds one or more values to the head of a LIST. Creates the list if the key didn't exist. If the key exists and is not a list, `FALSE` is returned.
19271927

1928-
##### *Parameters*
1929-
*key*
1930-
*value* String, value to push in key
1928+
##### *Prototype*
1929+
~~~php
1930+
$redis->lPush($key, $entry [, $entry, $entry]);
1931+
~~~
19311932

19321933
##### *Return value*
19331934
*LONG* The new length of the list in case of success, `FALSE` in case of Failure.
19341935

19351936
##### *Examples*
19361937
~~~php
19371938
$redis->del('key1');
1938-
$redis->lPush('key1', 'C'); // returns 1
1939-
$redis->lPush('key1', 'B'); // returns 2
1940-
$redis->lPush('key1', 'A'); // returns 3
1941-
/* key1 now points to the following list: [ 'A', 'B', 'C' ] */
1939+
$redis->lPush('key1', 'F'); // returns 1
1940+
$redis->lPush('key1', 'E'); // returns 2
1941+
$redis->lPush('key1', 'D'); // returns 3
1942+
/* key1 now contains: [ 'D', 'E', 'F' ] */
1943+
1944+
$redis->lPush('key1', 'C', 'B', 'A'); // Returns 6
1945+
/* key1 now contains: [ 'A', 'B', 'C', 'D', 'E', 'F' ]
19421946
~~~
19431947

19441948
### lPushx
@@ -2127,22 +2131,24 @@ array(3) {
21272131

21282132
### rPush
21292133
-----
2130-
_**Description**_: Adds the string value to the tail (right) of the list. Creates the list if the key didn't exist. If the key exists and is not a list, `FALSE` is returned.
2134+
_**Description**_: Adds one or more entries to the tail of a LIST. Redis will create the list if it doesn't exist.
21312135

2132-
##### *Parameters*
2133-
*key*
2134-
*value* String, value to push in key
2136+
##### *Prototype*
2137+
~~~php
2138+
$redis->rPush($key, $entry [, $entry, $entry]);
2139+
~~~
21352140

21362141
##### *Return value*
21372142
*LONG* The new length of the list in case of success, `FALSE` in case of Failure.
21382143

21392144
##### *Examples*
21402145
~~~php
21412146
$redis->del('key1');
2142-
$redis->rPush('key1', 'A'); // returns 1
2143-
$redis->rPush('key1', 'B'); // returns 2
2144-
$redis->rPush('key1', 'C'); // returns 3
2145-
/* key1 now points to the following list: [ 'A', 'B', 'C' ] */
2147+
$redis->rPush('key1', 'A'); // returns 1
2148+
$redis->rPush('key1', 'B'); // returns 2
2149+
$redis->rPush('key1', 'C'); // returns 3
2150+
$redis->rPush('key1', 'D', 'E', 'F'); // returns 6
2151+
/* key1 now contains: [ 'A', 'B', 'C', 'D', 'E', 'F' ] */
21462152
~~~
21472153

21482154
### rPushX

0 commit comments

Comments
 (0)