redis_lindex()

Read(227) Label: key, index,

Description:

Get a member from a list by its index.

Syntax:

redis_lindex(con,key,index)

Note:

External library function. The parameter index representing an index starts from 0. That is to say, 0 represents the first member in the list, 1 the second member, and so on. The indexes can also be negative. -1 represents the last member in the list, -2 the second-to-last member, and so on. If the index value is beyond the range of the indexes of the list members, the function returns an empty value. If the data type of the parameter key isn’t list, an error will be reported.

Parameters:

con

Database connection string

key

List name

index

Index

Return value:

The list members whose indexes are the parmeter index.

Example:

 

A

 

1

=redis("192.168.18.131:6379","runqian")

 

2

=redis_lindex(A1,"mylist",0)

3

=redis_lindex(A1,"mylist",1)

4

=redis_lindex(A1,"mylist",2)

5

=redis_lindex(A1,"mylist",-1)