问题
Is there a way to pass the return value of one function to another in Redis? Of course, if you're using a language wrapper (like Ruby), it's easy — but what about from the CLI?
e.g. something like this, bash style
redis 127.0.0.1:6379> keys student* | mget
or something like this
redis 127.0.0.1:6379> mget(keys student*)
keys student*
will return a list of keys, but I've no idea how to fetch all the values for those keys.
Thoughts?
回答1:
From the CLI, you just have to let the shell do its job.
./redis-cli --raw keys 'student:*' | awk '{printf "get %s\n", $1}' | ./redis-cli --raw
Please note you are not supposed to use the keys command in applications because of its linear complexity.
来源:https://stackoverflow.com/questions/12313412/pass-results-to-another-command-in-redis