mirror of https://github.com/go-redis/redis.git
commands.go: add section parameter to Info function.
This commit is contained in:
parent
0363b69248
commit
602824623b
|
@ -1454,9 +1454,12 @@ func (c *commandable) FlushDb() *StatusCmd {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *commandable) Info() *StringCmd {
|
func (c *commandable) Info(section ...string) *StringCmd {
|
||||||
cmd := NewStringCmd("INFO")
|
args := []interface{}{"INFO"}
|
||||||
cmd._clusterKeyPos = 0
|
if len(section) > 0 {
|
||||||
|
args = append(args, section[0])
|
||||||
|
}
|
||||||
|
cmd := NewStringCmd(args...)
|
||||||
c.Process(cmd)
|
c.Process(cmd)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,13 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(info.Val()).NotTo(Equal(""))
|
Expect(info.Val()).NotTo(Equal(""))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
It("should Info cpu", func() {
|
||||||
|
info := client.Info("cpu")
|
||||||
|
Expect(info.Err()).NotTo(HaveOccurred())
|
||||||
|
Expect(info.Val()).NotTo(Equal(""))
|
||||||
|
Expect(info.Val()).To(ContainSubstring(`used_cpu_sys`))
|
||||||
|
})
|
||||||
|
|
||||||
It("should LastSave", func() {
|
It("should LastSave", func() {
|
||||||
lastSave := client.LastSave()
|
lastSave := client.LastSave()
|
||||||
Expect(lastSave.Err()).NotTo(HaveOccurred())
|
Expect(lastSave.Err()).NotTo(HaveOccurred())
|
||||||
|
|
Loading…
Reference in New Issue