在文档里也没找到, 偶然发现其实监听主题,然后我这样做
psc := redis.PubSubConn{Conn: red}
psc.Subscribe("__keyspace@1__:del")
for {
switch v := psc.Receive().(type) {
case redis.Message:
fmt.Printf("%s: message: %s\n", v.Channel, v.Data)
case redis.Subscription:
fmt.Printf("%s: %s %d\n", v.Channel, v.Kind, v.Count)
case error:
fmt.Println("error")
}
}
![image.png](https://static.studygolang.com/210129/282ad43721ed91f9f9b026df6ec526b3.png)
监听一号库的删除事件,好像也不行啊,?
有疑问加站长微信联系(非本文作者)