redis_lrange()

Read(241) Label: key, range, offset value,

Decription:

Get a range of members in a list with indexes within the given offset values start and stop.

Syntax:

redis_lrange(con,key,start,stop)

Note:

External library function. Both index parameters start and stop start 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.

A start or stop value that is beyond the range of the indexes of the list members won’t result in an error report. If the start value is outside the range of the indexes, the function won’t return a list. If the stop value is outside the range of the indexes, the Redis database will automatically set its value as the ending index of the list members. An error report will pop up if the data type of the parameter key isn’t list.

Parameters:

con

Database connection string

key

List name

start

Starting index

stop

Ending index

Return value:

A list containing members within the given values.

Example:

 

A

 

1

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

 

2

=redis_lrange(A1,"fp-language",0,1)

3

=redis_lrange(A1,"fp-language",0,2)

4

=redis_lrange(A1,"fp-language",2,3)