For example:
$ redis-cli> timer "local a = 1 + 2" 1000
would execute local a = 1 + 2 every 1 second。
Some time we would doing something by timer,example:Check key if exists and doing something.
Comment From: enjoy-binbin
it sounds like this timer things should be done the the client side, rather than the redis server side. like when do you stop the timer? delete a timer, update a timer, it will need a lot code in the server side
but in the client side, you can control everything, like a while loop, check the key exist or not, do some things
Comment From: sundb
Wouldn't it be better to use shell command for this?
while true; do redis-cli eval "local a = 1 + 2" 0; sleep 1; done
Comment From: madolson
I think it's a reasonable idea, and might play in more interestingly with functions as a cron.
Comment From: tzongw
Hey, I am doing some similar things, hope this project can help. redis-timer