使用redis cli执行批量命令 [英] Executing batches of commands using redis cli

查看:56
本文介绍了使用redis cli执行批量命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很长的 redis 命令文本文件,需要使用 redis 命令行界面执行:

I have a long text file of redis commands that I need to execute using the redis command line interface:

例如

DEL 9012012
DEL 1212
DEL 12214314

我似乎无法找到一种比一次输入命令更快的方法.有几十万行,所以我不想把它们都堆成一个 DEL 命令,它们也不需要一次全部运行.

I can't seem to figure out a way to enter the commands faster than one at a time. There are several hundred thousands lines, so I don't want to just pile them all into one DEL command, they also don't need to all run at once.

推荐答案

以下代码适用于我在 mac 上使用 redis 2.4.7

the following code works for me with redis 2.4.7 on mac

./redis-cli < temp.redisCmds

这是否满足您的要求?或者您想看看是否有办法以编程方式更快地完成?

Does that satisfy your requirements? Or are you looking to see if there's a way to programmatically do it faster?

这篇关于使用redis cli执行批量命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆