Sunday, 12 April 2015

LPUSHX key value


Syntax
LPUSHX key value
     Insert value into the list only if list exists.

Returns
Length of the list after push operation.
127.0.0.1:6379> keys * 
1) "hello" 
2) "var1" 
3) "welcome" 
127.0.0.1:6379> 
127.0.0.1:6379> lpushx ids 1 
(integer) 0 
127.0.0.1:6379> 
127.0.0.1:6379> keys * 
1) "hello" 
2) "var1" 
3) "welcome" 
127.0.0.1:6379> 
127.0.0.1:6379> lpush ids 1 2 3 
(integer) 3 
127.0.0.1:6379> 
127.0.0.1:6379> keys * 
1) "hello" 
2) "ids" 
3) "var1" 
4) "welcome" 
127.0.0.1:6379> lpushx ids 1 
(integer) 4 
127.0.0.1:6379> lrange ids 0 3 
1) "1" 
2) "3" 
3) "2" 
4) "1" 

 
Prevoius                                                 Next                                                 Home

No comments:

Post a Comment