package redisx import ( "context" "time" ) // 字符串操作封装 func Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error { return getClient().Set(ctx, key, value, ttl).Err() } func Get(ctx context.Context, key string) (string, error) { return getClient().Get(ctx, key).Result() } func MSet(ctx context.Context, pairs ...interface{}) error { return getClient().MSet(ctx, pairs...).Err() } func MGet(ctx context.Context, keys ...string) ([]interface{}, error) { return getClient().MGet(ctx, keys...).Result() } func Incr(ctx context.Context, key string) (int64, error) { return getClient().Incr(ctx, key).Result() }