mirror of
https://github.com/redis/go-redis.git
synced 2025-06-14 01:21:30 +03:00
add new command Touch and SwapDB
This commit is contained in:
committed by
Vladimir Mihailenco
parent
32f020f1fa
commit
daab7c60d0
@ -79,6 +79,16 @@ var _ = Describe("Commands", func() {
|
||||
Expect(sel.Val()).To(Equal("OK"))
|
||||
})
|
||||
|
||||
It("should SwapDB", func() {
|
||||
pipe := client.Pipeline()
|
||||
sel := pipe.SwapDB(1, 2)
|
||||
_, err := pipe.Exec()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
Expect(sel.Err()).NotTo(HaveOccurred())
|
||||
Expect(sel.Val()).To(Equal("OK"))
|
||||
})
|
||||
|
||||
It("should BgRewriteAOF", func() {
|
||||
Skip("flaky test")
|
||||
|
||||
@ -650,6 +660,20 @@ var _ = Describe("Commands", func() {
|
||||
Expect(els).To(Equal([]string{"1", "2"}))
|
||||
})
|
||||
|
||||
It("should Touch", func() {
|
||||
set1 := client.Set("touch1", "hello", 0)
|
||||
Expect(set1.Err()).NotTo(HaveOccurred())
|
||||
Expect(set1.Val()).To(Equal("OK"))
|
||||
|
||||
set2 := client.Set("touch2", "hello", 0)
|
||||
Expect(set2.Err()).NotTo(HaveOccurred())
|
||||
Expect(set2.Val()).To(Equal("OK"))
|
||||
|
||||
touch := client.Touch("touch1", "touch2", "touch3")
|
||||
Expect(touch.Err()).NotTo(HaveOccurred())
|
||||
Expect(touch.Val()).To(Equal(int64(2)))
|
||||
})
|
||||
|
||||
It("should TTL", func() {
|
||||
ttl := client.TTL("key")
|
||||
Expect(ttl.Err()).NotTo(HaveOccurred())
|
||||
|
Reference in New Issue
Block a user