3 ms·
I keep a bunch of small scripts for common tasks like deleting or aggregating keys maching certain criteria. I wish redis offered a mechanism to save and call
by joaomsa 10y ago
I keep a bunch of small scripts for common tasks like deleting or aggregating keys maching certain criteria.
I wish redis offered a mechanism to save and call these scripts from the server, akin to the usual database functions and stored procedures.
I wonder if this was a conscious decision or something that's in the pipeline eventually.
- ryanworl 10y agoWhat about this? http://redis.io/commands/script-load http://redis.io/commands/script-load http://redis.io/commands/evalsha http://redis.io/commands/evalsha EDIT: I realize this was mentioned in the article, just wondering why it doesn't fit your needs.
- thezilch 10y agoI believe the ask is to have any scripts loaded to persist through restarts of Redis. As is, you have to reload them on each init of Redis. As such, the onus is on applications to catch evalsha errors and load the missing scripts, in the case of Redis being restarted.
- unrealhoang 10y agoWe built the same mechanism using HashMap and `SCRIPT LOAD` on restart/deployment to make a mapping table between function name and its SHA. Any client want to call the function just need to fetch the table and using the according SHA via `EVALSHA` command.