ioredis
ioredis copied to clipboard
Proposal: Make Script and Script.execute a stable api
For #1027
Having a stable low level api to evaluate scripts would be something I'd personally consider useful for:
- Third party libraries that prefer avoiding mutating the passed in redis instance
- Applications where the redis instance is a Proxy<Redis> (and the commands defined in other modules may be lost when the underlying instance changes).
If the concept makes sense to ioredis maintainers, more tests will be added.
Aside: Would adding Commander.getKeyPrefix make sense? Or should this stop passing in the keyPrefix to the Script constructor and use something like container?.options?.keyPrefix instead?
Would adding Commander.getKeyPrefix make sense?
What would it look like with this approach? Should Script call that method?
What would it look like with this approach? Should
Scriptcall that method?
Yes, that's what I had in mind so that a script could be called by any Commander and automatically use the right key prefix if they weren't overridden in an options object
I'd suggested that because I didn't know what guarantees the maintainers had about redisClient.options.keyPrefix being stable - would it work with ioredis-mock? Clusters or similar collections? Would it work in future refactorings (e.g. private properties decades from now).