DEV Community

Cover image for Running a Redis command n times
Talles L
Talles L

Posted on

Running a Redis command n times

Did you know that you can prefix any Redis command with a number to make it run multiple times on redis-cli?

127.0.0.1:6379> 5 lpush mylist myvalue
(integer) 1
(integer) 2
(integer) 3
(integer) 4
(integer) 5
127.0.0.1:6379> lrange mylist 0 -1
1) "myvalue"
2) "myvalue"
3) "myvalue"
4) "myvalue"
5) "myvalue"
Enter fullscreen mode Exit fullscreen mode

Discussion (0)