Module Hub Beta

LPUSHCAPPED

key cap ele [ele ...]

Pushes elements to the head of a list, but trims it from the opposite end to cap afterwards, if reached.

Return Value

Integer reply: the length of the list after the push operations.

Examples

redis> LPUSHCAPPED mylist 5 5 4 3 2 1
(integer) 5
redis> LRANGE mylist 0 -1
1) “1”
2) “2”
3) “3”
4) “4”
5) “5”
redis> LPUSHCAPPED mylist 5 a b c
(integer) 5
redis> LRANGE mylist 0 -1
1) “c”
2) “b”
3) “a”
4) “1”
5) “2”

© 2017 Redis Labs, Inc. All rights reserved.