diff --git a/internal/cmds/gen_bf.go b/internal/cmds/gen_bf.go index 58d4c0d5..76206dff 100644 --- a/internal/cmds/gen_bf.go +++ b/internal/cmds/gen_bf.go @@ -29,11 +29,6 @@ func (c BfAddItem) Build() Completed { return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} } -func (c BfAddItem) Cache() Cacheable { - c.cs.Build() - return Cacheable{cs: c.cs, cf: uint16(c.cf), ks: c.ks} -} - type BfAddKey Incomplete func (c BfAddKey) Item(item string) BfAddItem { diff --git a/internal/cmds/gen_bf_test.go b/internal/cmds/gen_bf_test.go index 6a0a194e..036d7663 100644 --- a/internal/cmds/gen_bf_test.go +++ b/internal/cmds/gen_bf_test.go @@ -6,7 +6,6 @@ import "testing" func bf0(s Builder) { s.BfAdd().Key("1").Item("1").Build() - s.BfAdd().Key("1").Item("1").Cache() s.BfCard().Key("1").Build() s.BfExists().Key("1").Item("1").Build() s.BfExists().Key("1").Item("1").Cache() diff --git a/internal/cmds/gen_cf.go b/internal/cmds/gen_cf.go index 333d789f..4794642f 100644 --- a/internal/cmds/gen_cf.go +++ b/internal/cmds/gen_cf.go @@ -29,11 +29,6 @@ func (c CfAddItem) Build() Completed { return Completed{cs: c.cs, cf: uint16(c.cf), ks: c.ks} } -func (c CfAddItem) Cache() Cacheable { - c.cs.Build() - return Cacheable{cs: c.cs, cf: uint16(c.cf), ks: c.ks} -} - type CfAddKey Incomplete func (c CfAddKey) Item(item string) CfAddItem { diff --git a/internal/cmds/gen_cf_test.go b/internal/cmds/gen_cf_test.go index b89e5211..1d5577bf 100644 --- a/internal/cmds/gen_cf_test.go +++ b/internal/cmds/gen_cf_test.go @@ -6,7 +6,6 @@ import "testing" func cf0(s Builder) { s.CfAdd().Key("1").Item("1").Build() - s.CfAdd().Key("1").Item("1").Cache() s.CfAddnx().Key("1").Item("1").Build() s.CfCount().Key("1").Item("1").Build() s.CfCount().Key("1").Item("1").Cache() diff --git a/rueidiscompat/adapter.go b/rueidiscompat/adapter.go index 0a47bca3..5a8df142 100644 --- a/rueidiscompat/adapter.go +++ b/rueidiscompat/adapter.go @@ -5050,12 +5050,6 @@ func (c CacheCompat) ZScore(ctx context.Context, key, member string) *FloatCmd { return newFloatCmd(resp) } -func (c CacheCompat) BFAdd(ctx context.Context, key string, element interface{}) *BoolCmd { - cmd := c.client.B().BfAdd().Key(key).Item(str(element)).Cache() - resp := c.client.DoCache(ctx, cmd, c.ttl) - return newBoolCmd(resp) -} - func (c CacheCompat) BFExists(ctx context.Context, key string, element interface{}) *BoolCmd { cmd := c.client.B().BfExists().Key(key).Item(str(element)).Cache() resp := c.client.DoCache(ctx, cmd, c.ttl) @@ -5115,11 +5109,6 @@ func (c CacheCompat) BFInfoExpansion(ctx context.Context, key string) *BFInfoCmd return newBFInfoCmd(resp) } -func (c *CacheCompat) CFAdd(ctx context.Context, key string, element interface{}) *BoolCmd { - cmd := c.client.B().CfAdd().Key(key).Item(str(element)).Cache() - return newBoolCmd(c.client.DoCache(ctx, cmd, c.ttl)) -} - func (c *CacheCompat) CFCount(ctx context.Context, key string, element interface{}) *IntCmd { cmd := c.client.B().CfCount().Key(key).Item(str(element)).Cache() return newIntCmd(c.client.DoCache(ctx, cmd, c.ttl)) diff --git a/rueidiscompat/adapter_test.go b/rueidiscompat/adapter_test.go index 4bfb6199..6b610fb6 100644 --- a/rueidiscompat/adapter_test.go +++ b/rueidiscompat/adapter_test.go @@ -8396,20 +8396,16 @@ func testAdapterCache(resp3 bool) { }})) }) - It("should BFAdd", func() { - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) - }) - It("should BFExists", func() { bfExists := adapter.Cache(time.Hour).BFExists(ctx, "key", "element") Expect(bfExists.Err()).NotTo(HaveOccurred()) }) It("should BFInfo", func() { - // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Check if the key exists bfExists := adapter.Cache(time.Hour).BFExists(ctx, "key", "element") @@ -8422,8 +8418,10 @@ func testAdapterCache(resp3 bool) { It("should BFInfoArg with CAPACITY", func() { // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Call BFInfoArg with CAPACITY bfInfo := adapter.Cache(time.Hour).BFInfoArg(ctx, "key", "CAPACITY") @@ -8432,8 +8430,10 @@ func testAdapterCache(resp3 bool) { It("should BFInfoArg with SIZE", func() { // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Call BFInfoArg with SIZE bfInfo := adapter.Cache(time.Hour).BFInfoArg(ctx, "key", "SIZE") @@ -8442,8 +8442,10 @@ func testAdapterCache(resp3 bool) { It("should BFInfoArg with FILTERS", func() { // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Call BFInfoArg with FILTERS bfInfo := adapter.Cache(time.Hour).BFInfoArg(ctx, "key", "FILTERS") @@ -8452,8 +8454,10 @@ func testAdapterCache(resp3 bool) { It("should BFInfoArg with ITEMS", func() { // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Call BFInfoArg with ITEMS bfInfo := adapter.Cache(time.Hour).BFInfoArg(ctx, "key", "ITEMS") @@ -8462,8 +8466,10 @@ func testAdapterCache(resp3 bool) { It("should BFInfoArg with EXPANSION", func() { // Add the key - bfAdd := adapter.Cache(time.Hour).BFAdd(ctx, "key", "element") - Expect(bfAdd.Err()).NotTo(HaveOccurred()) + bfAdd, err := adapter.BFAdd(ctx, "key", "element").Result() + + Expect(err).NotTo(HaveOccurred()) + Expect(bfAdd).To(BeTrue()) // Call BFInfoArg with EXPANSION bfInfo := adapter.Cache(time.Hour).BFInfoArg(ctx, "key", "EXPANSION") @@ -8471,12 +8477,11 @@ func testAdapterCache(resp3 bool) { }) It("should CFCount", func() { - cache := adapter.Cache(time.Hour) - // Add the key - cfAdd := cache.CFCount(ctx, "cf_key", "element") + cfAdd := adapter.CFAdd(ctx, "cf_key", "element") Expect(cfAdd.Err()).NotTo(HaveOccurred()) // Call CFCount + cache := adapter.Cache(time.Hour) cfCount := cache.CFCount(ctx, "cf_key", "element") Expect(cfCount.Err()).NotTo(HaveOccurred()) }) @@ -8484,7 +8489,7 @@ func testAdapterCache(resp3 bool) { It("should CFExists", func() { cache := adapter.Cache(time.Hour) // Add the key - cfAdd := cache.CFExists(ctx, "cf_key", "element") + cfAdd := adapter.CFAdd(ctx, "cf_key", "element") Expect(cfAdd.Err()).NotTo(HaveOccurred()) // Call CFExists @@ -8496,7 +8501,7 @@ func testAdapterCache(resp3 bool) { cache := adapter.Cache(time.Hour) // Add the key - cfAdd := cache.CFAdd(ctx, "cf_key", "element") + cfAdd := adapter.CFAdd(ctx, "cf_key", "element") Expect(cfAdd.Err()).NotTo(HaveOccurred()) // Call CFInfo