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

dynamic NUMBER_OF_KEYS for Lua Script #1990

Closed
namgk opened this issue Feb 17, 2022 · 4 comments · Fixed by #2020
Closed

dynamic NUMBER_OF_KEYS for Lua Script #1990

namgk opened this issue Feb 17, 2022 · 4 comments · Fixed by #2020
Labels

Comments

@namgk
Copy link

namgk commented Feb 17, 2022

Hi there,

How do I code a lua script that has a dynamic NUMBER_OF_KEYS?

Something like mHmGet?

Here's the lua script that I've got:

`local res = {} for i, key in ipairs(KEYS) do     res[#res+1] = redis.call("HMGET", key, ${projection.join(',')}) end  return res`

Thanks

@leibale
Copy link
Contributor

leibale commented Feb 21, 2022

You can't 🤦‍♂️

I think I'll make script.NUMBER_OF_KEYS optional, and then you'll be able to prepend it to args in script.transformArguments. WDYT?

@namgk
Copy link
Author

namgk commented Feb 21, 2022 via email

@leibale
Copy link
Contributor

leibale commented Feb 21, 2022

You cannot extend the client with a script on the fly, but you can always use client.executeScript

@namgk
Copy link
Author

namgk commented Feb 22, 2022 via email

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

Successfully merging a pull request may close this issue.

2 participants