mirror of https://github.com/go-redis/redis.git
Compare commits
2 Commits
5c486cf98a
...
6a0c42198f
Author | SHA1 | Date |
---|---|---|
Monkey | 6a0c42198f | |
monkey92t | 0a57079ece |
48
commands.go
48
commands.go
|
@ -13,7 +13,7 @@ import (
|
||||||
// otherwise you will receive an error: (error) ERR syntax error.
|
// otherwise you will receive an error: (error) ERR syntax error.
|
||||||
// For example:
|
// For example:
|
||||||
//
|
//
|
||||||
// rdb.Set(ctx, key, value, redis.KeepTTL)
|
// rdb.Set(ctx, key, value, redis.KeepTTL)
|
||||||
const KeepTTL = -1
|
const KeepTTL = -1
|
||||||
|
|
||||||
func usePrecise(dur time.Duration) bool {
|
func usePrecise(dur time.Duration) bool {
|
||||||
|
@ -96,10 +96,6 @@ type Cmdable interface {
|
||||||
Exists(ctx context.Context, keys ...string) *IntCmd
|
Exists(ctx context.Context, keys ...string) *IntCmd
|
||||||
Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
Expire(ctx context.Context, key string, expiration time.Duration) *BoolCmd
|
||||||
ExpireAt(ctx context.Context, key string, tm time.Time) *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
|
Keys(ctx context.Context, pattern string) *StringSliceCmd
|
||||||
Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd
|
Migrate(ctx context.Context, host, port, key string, db int, timeout time.Duration) *StatusCmd
|
||||||
Move(ctx context.Context, key string, db int) *BoolCmd
|
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, "")
|
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(
|
func (c cmdable) expire(
|
||||||
ctx context.Context, key string, expiration time.Duration, mode string,
|
ctx context.Context, key string, expiration time.Duration, mode string,
|
||||||
) *BoolCmd {
|
) *BoolCmd {
|
||||||
|
@ -2049,8 +2029,10 @@ func xClaimArgs(a *XClaimArgs) []interface{} {
|
||||||
|
|
||||||
// xTrim If approx is true, add the "~" parameter, otherwise it is the default "=" (redis default).
|
// xTrim If approx is true, add the "~" parameter, otherwise it is the default "=" (redis default).
|
||||||
// example:
|
// example:
|
||||||
// XTRIM key MAXLEN/MINID threshold LIMIT limit.
|
//
|
||||||
// XTRIM key MAXLEN/MINID ~ threshold LIMIT limit.
|
// XTRIM key MAXLEN/MINID threshold LIMIT limit.
|
||||||
|
// XTRIM key MAXLEN/MINID ~ threshold LIMIT limit.
|
||||||
|
//
|
||||||
// The redis-server version is lower than 6.2, please set limit to 0.
|
// The redis-server version is lower than 6.2, please set limit to 0.
|
||||||
func (c cmdable) xTrim(
|
func (c cmdable) xTrim(
|
||||||
ctx context.Context, key, strategy string,
|
ctx context.Context, key, strategy string,
|
||||||
|
@ -2298,6 +2280,7 @@ func (c cmdable) ZAddXX(ctx context.Context, key string, members ...*Z) *IntCmd
|
||||||
|
|
||||||
// ZAddCh Redis `ZADD key CH score member [score member ...]` command.
|
// ZAddCh Redis `ZADD key CH score member [score member ...]` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgs(ctx, ZAddArgs{
|
// client.ZAddArgs(ctx, ZAddArgs{
|
||||||
// Ch: true,
|
// Ch: true,
|
||||||
// Members: []Z,
|
// Members: []Z,
|
||||||
|
@ -2311,6 +2294,7 @@ func (c cmdable) ZAddCh(ctx context.Context, key string, members ...*Z) *IntCmd
|
||||||
|
|
||||||
// ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.
|
// ZAddNXCh Redis `ZADD key NX CH score member [score member ...]` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgs(ctx, ZAddArgs{
|
// client.ZAddArgs(ctx, ZAddArgs{
|
||||||
// NX: true,
|
// NX: true,
|
||||||
// Ch: true,
|
// Ch: true,
|
||||||
|
@ -2326,6 +2310,7 @@ func (c cmdable) ZAddNXCh(ctx context.Context, key string, members ...*Z) *IntCm
|
||||||
|
|
||||||
// ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.
|
// ZAddXXCh Redis `ZADD key XX CH score member [score member ...]` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgs(ctx, ZAddArgs{
|
// client.ZAddArgs(ctx, ZAddArgs{
|
||||||
// XX: true,
|
// XX: true,
|
||||||
// Ch: true,
|
// Ch: true,
|
||||||
|
@ -2341,6 +2326,7 @@ func (c cmdable) ZAddXXCh(ctx context.Context, key string, members ...*Z) *IntCm
|
||||||
|
|
||||||
// ZIncr Redis `ZADD key INCR score member` command.
|
// ZIncr Redis `ZADD key INCR score member` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
||||||
// Members: []Z,
|
// Members: []Z,
|
||||||
// })
|
// })
|
||||||
|
@ -2353,6 +2339,7 @@ func (c cmdable) ZIncr(ctx context.Context, key string, member *Z) *FloatCmd {
|
||||||
|
|
||||||
// ZIncrNX Redis `ZADD key NX INCR score member` command.
|
// ZIncrNX Redis `ZADD key NX INCR score member` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
||||||
// NX: true,
|
// NX: true,
|
||||||
// Members: []Z,
|
// Members: []Z,
|
||||||
|
@ -2367,6 +2354,7 @@ func (c cmdable) ZIncrNX(ctx context.Context, key string, member *Z) *FloatCmd {
|
||||||
|
|
||||||
// ZIncrXX Redis `ZADD key XX INCR score member` command.
|
// ZIncrXX Redis `ZADD key XX INCR score member` command.
|
||||||
// Deprecated: Use
|
// Deprecated: Use
|
||||||
|
//
|
||||||
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
// client.ZAddArgsIncr(ctx, ZAddArgs{
|
||||||
// XX: true,
|
// XX: true,
|
||||||
// Members: []Z,
|
// Members: []Z,
|
||||||
|
@ -2488,11 +2476,13 @@ func (c cmdable) ZPopMin(ctx context.Context, key string, count ...int64) *ZSlic
|
||||||
|
|
||||||
// ZRangeArgs is all the options of the ZRange command.
|
// ZRangeArgs is all the options of the ZRange command.
|
||||||
// In version> 6.2.0, you can replace the(cmd):
|
// In version> 6.2.0, you can replace the(cmd):
|
||||||
// ZREVRANGE,
|
//
|
||||||
// ZRANGEBYSCORE,
|
// ZREVRANGE,
|
||||||
// ZREVRANGEBYSCORE,
|
// ZRANGEBYSCORE,
|
||||||
// ZRANGEBYLEX,
|
// ZREVRANGEBYSCORE,
|
||||||
// ZREVRANGEBYLEX.
|
// ZRANGEBYLEX,
|
||||||
|
// ZREVRANGEBYLEX.
|
||||||
|
//
|
||||||
// Please pay attention to your redis-server version.
|
// Please pay attention to your redis-server version.
|
||||||
//
|
//
|
||||||
// Rev, ByScore, ByLex and Offset+Count options require redis-server 6.2.0 and higher.
|
// Rev, ByScore, ByLex and Offset+Count options require redis-server 6.2.0 and higher.
|
||||||
|
@ -2897,7 +2887,7 @@ func (c cmdable) ClientKill(ctx context.Context, ipPort string) *StatusCmd {
|
||||||
|
|
||||||
// ClientKillByFilter is new style syntax, while the ClientKill is old
|
// ClientKillByFilter is new style syntax, while the ClientKill is old
|
||||||
//
|
//
|
||||||
// CLIENT KILL <option> [value] ... <option> [value]
|
// CLIENT KILL <option> [value] ... <option> [value]
|
||||||
func (c cmdable) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd {
|
func (c cmdable) ClientKillByFilter(ctx context.Context, keys ...string) *IntCmd {
|
||||||
args := make([]interface{}, 2+len(keys))
|
args := make([]interface{}, 2+len(keys))
|
||||||
args[0] = "client"
|
args[0] = "client"
|
||||||
|
|
Loading…
Reference in New Issue