summaryrefslogtreecommitdiffstats
path: root/iredis/data/commands/lpos.md
diff options
context:
space:
mode:
Diffstat (limited to 'iredis/data/commands/lpos.md')
-rw-r--r--iredis/data/commands/lpos.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/iredis/data/commands/lpos.md b/iredis/data/commands/lpos.md
index c256e0e..77516e1 100644
--- a/iredis/data/commands/lpos.md
+++ b/iredis/data/commands/lpos.md
@@ -2,7 +2,7 @@ The command returns the index of matching elements inside a Redis list. By
default, when no options are given, it will scan the list from head to tail,
looking for the first match of "element". If the element is found, its index
(the zero-based position in the list) is returned. Otherwise, if no match is
-found, NULL is returned.
+found, `nil` is returned.
```
> RPUSH mylist a b c 1 2 3 c c
@@ -64,12 +64,12 @@ indexes. This is better than giving a very large `COUNT` option because it is
more general.
```
-> LPOS mylist COUNT 0
+> LPOS mylist c COUNT 0
[2,6,7]
```
When `COUNT` is used and no match is found, an empty array is returned. However
-when `COUNT` is not used and there are no matches, the command returns NULL.
+when `COUNT` is not used and there are no matches, the command returns `nil`.
Finally, the `MAXLEN` option tells the command to compare the provided element
only with a given maximum number of list items. So for instance specifying
@@ -80,9 +80,13 @@ useful to limit the maximum complexity of the command. It is also useful when we
expect the match to be found very early, but want to be sure that in case this
is not true, the command does not take too much time to run.
+When `MAXLEN` is used, it is possible to specify 0 as the maximum number of
+comparisons, as a way to tell the command we want unlimited comparisons. This is
+better than giving a very large `MAXLEN` option because it is more general.
+
@return
-The command returns the integer representing the matching element, or null if
+The command returns the integer representing the matching element, or `nil` if
there is no match. However, if the `COUNT` option is given the command returns
an array (empty if there are no matches).