When calling Lua scripts from within Redis, it is possible to pass values in two arrays: KEYS and ARGV. What is the difference? How does Redis treat values in the KEYS array? What if, in my script, I have to use keys dynamically generated at run time?
相关问题
- Getting Redis Master address from Sentinel C#
- Configuring Redis to play nice with AppHarbor
- Why do we need Redis for running CKAN?
- Problem in deserialize redis-cache to objects in S
- wait for all promises to finish in nodejs with blu
All your questions are answered at the
EVAL
page, but since you asked...:KEYS
is used to pass key names whereasARGS
should be for anything else. This isn't exactly enforced (i.e. most times you'd be ok mixing them) but could lead to potential problems if not followed.The contents of
KEYS
are checked to verify that all keys are available to the Redis shard that's running the script. This mechanism is in place to allow running scripts in a Redis cluster deployment.See previous answers - that's doable but you'd going against the recommendations. Your script will be safe to run only on a stand alone Redis instance and since this behavior isn't specified, it may break in future releases.