index

UK[ˈɪndeks] US[ˈɪnˌdɛks]

n.index;<number>index;indication;sign

vt. Index...; index...; [Economics] Adjust according to living index (wages, prices, etc.)

vi.[Mechanics] Transposition

Third person singular : indexes Plural: indices indexes Present participle: indexing Past tense: indexed Past participle: indexed

redis LINDEX command syntax

Function: Returns the element whose subscript is index in the list key.

Syntax: LINDEX key index

Description:The subscript (index) parameters start and stop are both base 0, that is to say, Let 0 represent the first element of the list, 1 represent the second element of the list, and so on. You can also use negative subscripts, with -1 representing the last element of the list, -2 representing the penultimate element of the list, and so on. If key is not a list type, an error is returned.

Available versions: >= 1.0.0

Time complexity: O(N), N is the process of reaching the index index The number of elements passed through. Therefore, executing the LINDEX command on the head and tail elements of the list has a complexity of O(1).

Return: The element whose subscript is index in the list. If the value of the index parameter is not out of the range of the list, nil is returned.

redis LINDEX command example

redis> LPUSH mylist "World"
(integer) 1
redis> LPUSH mylist "Hello"
(integer) 2
redis> LINDEX mylist 0
"Hello"
redis> LINDEX mylist -1
"World"
redis> LINDEX mylist 3        # index不在 mylist 的区间范围内
(nil)