Sunday, 12 April 2015

RPUSH key value

Syntax
RPUSH key value
     Insert all the specified values at the tail of the list. If key doesn't exist, it creates empty list.

Returns
Returns the length of the list after push operation.

127.0.0.1:6379> rpush ids 1 2 3 4 5 6 7 8 9 
(integer) 9 
127.0.0.1:6379> lrange ids 0 9 
1) "1" 
2) "2" 
3) "3" 
4) "4" 
5) "5" 
6) "6" 
7) "7" 
8) "8" 
9) "9" 


When key holds a value that is not a list, an error is returned.

127.0.0.1:6379> set a 10 
OK 
127.0.0.1:6379> rpush a 1 2 3 4 5 6 7 8 9 
(error) WRONGTYPE Operation against a key holding the wrong kind of value 
 
 
 

Prevoius                                                 Next                                                 Home

No comments:

Post a Comment