简体   繁体   English

如何使用Redigo进行“冲洗”?

[英]How can I “SCRIPT FLUSH” with Redigo?

I try to flush the scripts using the command:" SCRIPT FLUSH" running the code like this: 我尝试使用以下命令刷新脚本:“ SCRIPT FLUSH”,运行如下代码:

c.Send("SCRIPT FLUSH")
c.Flush()
spew.Dump(c.Receive())

But I get this output: 但是我得到以下输出:

(interface {}) <nil>
(redis.Error) (len=33) ERR unknown command 'SCRIPT FLUSH'

When I run the command from the command line I get an OK response: 当我从命令行运行命令时,我得到一个好的响应:

在此处输入图片说明

How can I solve this problem? 我怎么解决这个问题?

Use two arguments: 使用两个参数:

c.Send("SCRIPT", "FLUSH")
c.Flush()
spew.Dump(c.Receive())

Also, use Do instead of the Send/Flush/Receive calls: 另外,使用Do代替Send / Flush / Receive调用:

spew.Dump(c.Do("SCRIPT", "FLUSH"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM