forked from mirror/redis
Merge pull request #269 from go-redis/fix/client-methods
Correct method accessors
This commit is contained in:
commit
0ea1bdd306
|
@ -583,7 +583,7 @@ func (c *commandable) SetNX(key string, value interface{}, expiration time.Durat
|
||||||
// Redis `SET key value [expiration] XX` command.
|
// Redis `SET key value [expiration] XX` command.
|
||||||
//
|
//
|
||||||
// Zero expiration means the key has no expiration time.
|
// Zero expiration means the key has no expiration time.
|
||||||
func (c *Client) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd {
|
func (c *commandable) SetXX(key string, value interface{}, expiration time.Duration) *BoolCmd {
|
||||||
var cmd *BoolCmd
|
var cmd *BoolCmd
|
||||||
if usePrecise(expiration) {
|
if usePrecise(expiration) {
|
||||||
cmd = NewBoolCmd("SET", key, value, "PX", formatMs(expiration), "XX")
|
cmd = NewBoolCmd("SET", key, value, "PX", formatMs(expiration), "XX")
|
||||||
|
@ -1282,7 +1282,7 @@ func (c *commandable) ZRevRangeByScore(key string, opt ZRangeByScore) *StringSli
|
||||||
return c.zRevRangeBy("ZREVRANGEBYSCORE", key, opt)
|
return c.zRevRangeBy("ZREVRANGEBYSCORE", key, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c commandable) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd {
|
func (c *commandable) ZRevRangeByLex(key string, opt ZRangeByScore) *StringSliceCmd {
|
||||||
return c.zRevRangeBy("ZREVRANGEBYLEX", key, opt)
|
return c.zRevRangeBy("ZREVRANGEBYLEX", key, opt)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
type Pipeline struct {
|
type Pipeline struct {
|
||||||
commandable
|
commandable
|
||||||
|
|
||||||
client *baseClient
|
client baseClient
|
||||||
|
|
||||||
mu sync.Mutex // protects cmds
|
mu sync.Mutex // protects cmds
|
||||||
cmds []Cmder
|
cmds []Cmder
|
||||||
|
|
4
redis.go
4
redis.go
|
@ -183,12 +183,12 @@ func (opt *Options) getIdleTimeout() time.Duration {
|
||||||
// underlying connections. It's safe for concurrent use by multiple
|
// underlying connections. It's safe for concurrent use by multiple
|
||||||
// goroutines.
|
// goroutines.
|
||||||
type Client struct {
|
type Client struct {
|
||||||
*baseClient
|
baseClient
|
||||||
commandable
|
commandable
|
||||||
}
|
}
|
||||||
|
|
||||||
func newClient(opt *Options, pool pool) *Client {
|
func newClient(opt *Options, pool pool) *Client {
|
||||||
base := &baseClient{opt: opt, connPool: pool}
|
base := baseClient{opt: opt, connPool: pool}
|
||||||
return &Client{
|
return &Client{
|
||||||
baseClient: base,
|
baseClient: base,
|
||||||
commandable: commandable{process: base.process},
|
commandable: commandable{process: base.process},
|
||||||
|
|
Loading…
Reference in New Issue