From 0b87c16b615f29334bf1ae51829dfe2f98657133 Mon Sep 17 00:00:00 2001 From: Vladimir Mihailenco Date: Thu, 14 May 2015 16:49:47 +0300 Subject: [PATCH] Remove PSetEx and SetEx. Set should be used instead. --- commands.go | 12 ------------ commands_test.go | 26 -------------------------- 2 files changed, 38 deletions(-) diff --git a/commands.go b/commands.go index 513f52ba..b6df30cf 100644 --- a/commands.go +++ b/commands.go @@ -470,12 +470,6 @@ func (c *commandable) MSetNX(pairs ...string) *BoolCmd { return cmd } -func (c *commandable) PSetEx(key string, expiration time.Duration, value string) *StatusCmd { - cmd := NewStatusCmd("PSETEX", key, formatMs(expiration), value) - c.Process(cmd) - return cmd -} - func (c *commandable) Set(key, value string, expiration time.Duration) *StatusCmd { args := []string{"SET", key, value} if expiration > 0 { @@ -501,12 +495,6 @@ func (c *commandable) SetBit(key string, offset int64, value int) *IntCmd { return cmd } -func (c *commandable) SetEx(key string, expiration time.Duration, value string) *StatusCmd { - cmd := NewStatusCmd("SETEX", key, formatSec(expiration), value) - c.Process(cmd) - return cmd -} - func (c *commandable) SetNX(key, value string, expiration time.Duration) *BoolCmd { var cmd *BoolCmd if expiration == 0 { diff --git a/commands_test.go b/commands_test.go index 7a2add44..6b275a66 100644 --- a/commands_test.go +++ b/commands_test.go @@ -872,22 +872,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()) @@ -911,16 +895,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())