Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add timer command to support execute Lua codes interval #10412

Open
liexusong opened this issue Mar 10, 2022 · 4 comments
Open

[NEW] Add timer command to support execute Lua codes interval #10412

liexusong opened this issue Mar 10, 2022 · 4 comments

Comments

@liexusong
Copy link
Contributor

liexusong commented Mar 10, 2022

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.

@enjoy-binbin
Copy link
Collaborator

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

@sundb
Copy link
Collaborator

sundb commented Mar 10, 2022

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

@madolson
Copy link
Contributor

madolson commented Apr 5, 2022

I think it's a reasonable idea, and might play in more interestingly with functions as a cron.

@tzongw
Copy link
Contributor

tzongw commented Jun 29, 2022

Hey, I am doing some similar things, hope this project can help.
redis-timer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants