我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何使用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:

enter image description here

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"))

近期文章

  • 困惑为什么这个CGO恐慌
  • 在Golang中使用libnfc
  • Golang RPC服务器Docker自动部署
  • 如何在Golang中比较HTML标记?
  • 无法列出书籍:错误1046:未选择数据库
  • 如何有效地在go的中间件中共享数据?
  • 通过SetDeadline()为TCP侦听器设置超时
  • 将渲染的电子邮件发送到SendGrid的最快方法
  • 去任意查询
  • Golang json / gob / xml中的序列化性能
  • 在go 1.4.2中使用net包编译静态链接的测试二进制代码
  • GOLang:提取XML问题
  • 数据无法保存在我的数据库中
  • Golang:基准基数树查找
  • 为什么Go build可执行文件在第三方库的osx 10.7或更低版​​本上不起作用?
  • Golang:计算两个字节数组之间的差异并修补数组
  • 带有Java客户端的golang服务器
  • 更新html页面而不重新加载golang
  • Go类型的代码生成/语法表示
  • 不了解mongoDB Update如何在Go中工作

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华