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
Why is spop not an allowed script command? #2139
Comments
Hey, That's because the https://github.com/antirez/redis/blob/unstable/src/t_set.c#L399-L402 Cheers! 😺 |
So a work-around would be to use srandmember and srem, or sscan and srem. On Wednesday, November 12, 2014, Michael Grunder notifications@github.com
|
Yeah either of those strategies should work for you. Which one you pick would just have to do with your use case specifically. |
Actually no, you can't do a write after a nondeterministic command for the
|
Yeah, @itapita is correct. I spaced out on that one for some reason. I need more (or maybe less) coffee. |
That's kind of a major draw-back. I guess I'm left with sorted sets. |
For anyone else looking at this in the future, I worked around the problem by doing srandmember outside of the script, then srem inside of the script, passing the member in, and that met my needs. |
I'm trying to write a lua script for redis that includes this line:
but I'm getting an error
This Redis command is not allowed from scripts
. It looks like this error is coming from this line in the source.As per https://github.com/antirez/redis/blob/unstable/src/redis.c#L163 , spop has the 's' flag set, which is REDIS_CMD_NOSCRIPT. Why was this set?
The text was updated successfully, but these errors were encountered: