简体   繁体   中英

How can I “SCRIPT FLUSH” with Redigo?

I try to flush the scripts using the command:" SCRIPT FLUSH" running the code like this:

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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