forked from mirror/redis
Compare commits
9 Commits
f8f4a2fad9
...
742df17fb8
Author | SHA1 | Date |
---|---|---|
re | 742df17fb8 | |
Monkey | 6c688c7e9f | |
monkey92t | 57918584b8 | |
monkey92t | 92fb134b81 | |
monkey92t | 2556b76824 | |
Monkey | 6a0c42198f | |
monkey92t | 0a57079ece | |
Monkey | 5c486cf98a | |
monkey92t | 0358ca4bfe |
|
@ -2,9 +2,9 @@ name: Go
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches: [master, v8]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
branches: [master, v8]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -13,11 +13,11 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
go-version: [1.17.x, 1.18.x]
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
|
||||
services:
|
||||
redis:
|
||||
image: redis
|
||||
image: redis:6.2.8
|
||||
options: >-
|
||||
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
ports:
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
*.rdb
|
||||
testdata/*/
|
||||
testdata/*
|
||||
.idea/
|
||||
|
|
|
@ -18,11 +18,12 @@ func (c *ClusterClient) DBSize(ctx context.Context) *IntCmd {
|
|||
atomic.AddInt64(&size, n)
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
cmd.SetErr(err)
|
||||
} else {
|
||||
cmd.val = size
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.val = size
|
||||
return nil
|
||||
})
|
||||
return cmd
|
||||
|
@ -46,10 +47,8 @@ func (c *ClusterClient) ScriptLoad(ctx context.Context, script string) *StringCm
|
|||
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
cmd.SetErr(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
return err
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
|
@ -60,10 +59,8 @@ func (c *ClusterClient) ScriptFlush(ctx context.Context) *StatusCmd {
|
|||
err := c.ForEachShard(ctx, func(ctx context.Context, shard *Client) error {
|
||||
return shard.ScriptFlush(ctx).Err()
|
||||
})
|
||||
if err != nil {
|
||||
cmd.SetErr(err)
|
||||
}
|
||||
return nil
|
||||
|
||||
return err
|
||||
})
|
||||
return cmd
|
||||
}
|
||||
|
@ -98,11 +95,12 @@ func (c *ClusterClient) ScriptExists(ctx context.Context, hashes ...string) *Boo
|
|||
|
||||
return nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
cmd.SetErr(err)
|
||||
} else {
|
||||
cmd.val = result
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.val = result
|
||||
return nil
|
||||
})
|
||||
return cmd
|
||||
|
|
20
commands.go
20
commands.go
|
@ -96,10 +96,6 @@ type Cmdable interface {
|
|||
Exists(ctx context.Context, keys ...string) *IntCmd
|
||||
Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||
ExpireAt(ctx context.Context, key string, tm time.Time) *BoolCmd
|
||||
ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||
ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||
ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||
ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||
Keys(ctx context.Context, pattern string) *StringSliceCmd
|
||||
Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd
|
||||
Move(ctx context.Context, key string, db int) *BoolCmd
|
||||
|
@ -534,22 +530,6 @@ func (c cmdable) Expire(ctx context.Context, key string, expiration time.Duratio
|
|||
return c.expire(ctx, key, expiration, "")
|
||||
}
|
||||
|
||||
func (c cmdable) ExpireNX(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
||||
return c.expire(ctx, key, expiration, "NX")
|
||||
}
|
||||
|
||||
func (c cmdable) ExpireXX(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
||||
return c.expire(ctx, key, expiration, "XX")
|
||||
}
|
||||
|
||||
func (c cmdable) ExpireGT(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
||||
return c.expire(ctx, key, expiration, "GT")
|
||||
}
|
||||
|
||||
func (c cmdable) ExpireLT(ctx context.Context, key string, expiration time.Duration) *BoolCmd {
|
||||
return c.expire(ctx, key, expiration, "LT")
|
||||
}
|
||||
|
||||
func (c cmdable) expire(
|
||||
ctx context.Context, key string, expiration time.Duration, mode string,
|
||||
) *BoolCmd {
|
||||
|
|
Loading…
Reference in New Issue