Adjust KeepTTL annotation.

Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
monkey92t 2021-06-25 14:51:18 +08:00
parent 960e4d6cf0
commit b64f087691
1 changed files with 10 additions and 10 deletions

View File

@ -9,8 +9,8 @@ import (
"github.com/go-redis/redis/v8/internal" "github.com/go-redis/redis/v8/internal"
) )
// KeepTTL is an option for Set command to keep key's existing TTL. // KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// It requires your redis-server version >= 6.0 (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)
@ -841,8 +841,8 @@ func (c cmdable) MSetNX(ctx context.Context, values ...interface{}) *BoolCmd {
// Use expiration for `SETEX`-like behavior. // Use expiration for `SETEX`-like behavior.
// //
// Zero expiration means the key has no expiration time. // Zero expiration means the key has no expiration time.
// KeepTTL(-1) expiration is a Redis KEEPTTL option to keep existing TTL. // KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// It requires your redis-server version >= 6.0 (Otherwise you will receive an error: (error) ERR syntax error). // otherwise you will receive an error: (error) ERR syntax error.
func (c cmdable) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd { func (c cmdable) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) *StatusCmd {
args := make([]interface{}, 3, 5) args := make([]interface{}, 3, 5)
args[0] = "set" args[0] = "set"
@ -875,8 +875,8 @@ type SetArgs struct {
// When Get is true, the command returns the old value stored at key, or nil when key did not exist. // When Get is true, the command returns the old value stored at key, or nil when key did not exist.
Get bool Get bool
// KeepTTL is a Redis KEEPTTL option to keep existing TTL. // KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// It requires your redis-server version >= 6.0 (Otherwise you will receive an error: (error) ERR syntax error). // otherwise you will receive an error: (error) ERR syntax error.
KeepTTL bool KeepTTL bool
} }
@ -924,8 +924,8 @@ func (c cmdable) SetEX(ctx context.Context, key string, value interface{}, expir
// SetNX Redis `SET key value [expiration] NX` command. // SetNX Redis `SET key value [expiration] NX` command.
// //
// Zero expiration means the key has no expiration time. // Zero expiration means the key has no expiration time.
// KeepTTL(-1) expiration is a Redis KEEPTTL option to keep existing TTL. // KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// It requires your redis-server version >= 6.0 (Otherwise you will receive an error: (error) ERR syntax error). // otherwise you will receive an error: (error) ERR syntax error.
func (c cmdable) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd { func (c cmdable) SetNX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd {
var cmd *BoolCmd var cmd *BoolCmd
switch expiration { switch expiration {
@ -949,8 +949,8 @@ func (c cmdable) SetNX(ctx context.Context, key string, value interface{}, expir
// SetXX Redis `SET key value [expiration] XX` command. // SetXX 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.
// KeepTTL(-1) expiration is a Redis KEEPTTL option to keep existing TTL. // KeepTTL is a Redis KEEPTTL option to keep existing TTL, it requires your redis-server version >= 6.0,
// It requires your redis-server version >= 6.0 (Otherwise you will receive an error: (error) ERR syntax error). // otherwise you will receive an error: (error) ERR syntax error.
func (c cmdable) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd { func (c cmdable) SetXX(ctx context.Context, key string, value interface{}, expiration time.Duration) *BoolCmd {
var cmd *BoolCmd var cmd *BoolCmd
switch expiration { switch expiration {