1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Merge pull request #107 from go-redis/fix/psetex-setex-remove

Remove PSetEx and SetEx. Set should be used instead.
This commit is contained in:
Vladimir Mihailenco
2015-05-15 13:02:15 +03:00
2 changed files with 0 additions and 38 deletions

View File

@ -873,22 +873,6 @@ var _ = Describe("Commands", func() {
Expect(mSetNX.Val()).To(Equal(false))
})
It("should PSetEx", func() {
expiration := 50 * time.Millisecond
psetex := client.PSetEx("key", expiration, "hello")
Expect(psetex.Err()).NotTo(HaveOccurred())
Expect(psetex.Val()).To(Equal("OK"))
pttl := client.PTTL("key")
Expect(pttl.Err()).NotTo(HaveOccurred())
Expect(pttl.Val() <= expiration).To(Equal(true))
Expect(pttl.Val() >= expiration-time.Millisecond).To(Equal(true))
get := client.Get("key")
Expect(get.Err()).NotTo(HaveOccurred())
Expect(get.Val()).To(Equal("hello"))
})
It("should Set with expiration", func() {
err := client.Set("key", "hello", 100*time.Millisecond).Err()
Expect(err).NotTo(HaveOccurred())
@ -912,16 +896,6 @@ var _ = Describe("Commands", func() {
Expect(get.Val()).To(Equal("hello"))
})
It("should SetEx", func() {
setEx := client.SetEx("key", 10*time.Second, "hello")
Expect(setEx.Err()).NotTo(HaveOccurred())
Expect(setEx.Val()).To(Equal("OK"))
ttl := client.TTL("key")
Expect(ttl.Err()).NotTo(HaveOccurred())
Expect(ttl.Val()).To(Equal(10 * time.Second))
})
It("should SetNX", func() {
setNX := client.SetNX("key", "hello", 0)
Expect(setNX.Err()).NotTo(HaveOccurred())