diff --git a/pool.go b/pool.go index 9f2f642..97a6324 100644 --- a/pool.go +++ b/pool.go @@ -290,6 +290,14 @@ func (p *Pool) SetRange(ctx context.Context, key string, offset int64, value str return conn.SetRange(ctx, key, offset, value) } +func (p *Pool) SetArgs(ctx context.Context, key string, value interface{}, a redis.SetArgs) *redis.StatusCmd { + conn, err := p.connFactory.getMasterConn(key) + if err != nil { + return newErrorStatusCmd(err) + } + return conn.SetArgs(ctx, key, value, a) +} + func (p *Pool) StrLen(ctx context.Context, key string) *redis.IntCmd { conn, err := p.connFactory.getSlaveConn(key) if err != nil { diff --git a/pool_test.go b/pool_test.go index 2660c0a..aeddb85 100644 --- a/pool_test.go +++ b/pool_test.go @@ -373,6 +373,16 @@ var _ = Describe("Pool", func() { } }) + It("setargs", func() { + key := "setargs_key" + for _, pool := range pools { + Expect(pool.SetArgs(ctx, key, "bar", redis.SetArgs{Mode: "XX"}).Val()).To(Equal("")) + Expect(pool.SetArgs(ctx, key, "bar", redis.SetArgs{}).Val()).To(Equal("OK")) + Expect(pool.SetArgs(ctx, key, "bar", redis.SetArgs{Mode: "NX"}).Val()).To(Equal("")) + _, _ = pool.Del(ctx, key) + } + }) + It("setrange", func() { key := "setrange_key" for _, pool := range pools { @@ -1191,7 +1201,6 @@ var _ = Describe("Pool", func() { } }) - It("ZAddGT", func() { for _, pool := range pools { _, err := pool.ZAddGT(ctx, "key", redis.Z{