pass results to another command in redis

谁说我不能喝 提交于 2019-12-07 07:38:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!