Module Hub Beta

RPUSHCAPPED

key cap ele [ele ...]

Pushes elements to the tail 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> RPUSHCAPPED mylist 5 5 4 3 2 1
(integer) 5
redis> LRANGE mylist 0 -1
1) “5”
2) “4”
3) “3”
4) “2”
5) “1”
redis> RPUSHCAPPED mylist 5 a b c
(integer) 5
redis> LRANGE mylist 0 -1
1) “2”
2) “1”
3) “a”
4) “b”
5) “c”

© 2017 Redis Labs, Inc. All rights reserved.