tencent cloud

Tencent Cloud Distributed Cache (Redis OSS-Compatible)

DokumentasiTencent Cloud Distributed Cache (Redis OSS-Compatible)

Strings Group

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-08-11 11:11:58
Diterjemahkan oleh AI

Command Introduction

The Strings command family is designed for basic read and write operations on string values and integer/floating-point numeric values, making it the most fundamental and frequently used data type command. Its core commands can be categorized into the following four types based on their features:
Basic Read/Write and Conditional Setting
SET / GET: Set and obtain string values.
MSET / MGET: Operate on multiple keys in batches.
GETSET: Sets a new value and returns the old value.
SETNX / SETEX / PSETEX: Provide conditional setting and setting with expiration time, making them suitable for distributed lock and caching scenarios.
String Operations
APPEND: Appends content to the end of the existing value.
GETRANGE / SETRANGE: Extract or overwrite substrings based on byte offset.
STRLEN: Returns the byte length of the value.
Atomic Counters
INCR / DECR / INCRBY / DECRBY / INCRBYFLOAT: Atomically increment or decrement numeric strings, making them suitable for scenarios such as counters, rate limiters, and inventory deduction.
Enhanced Commands for Higher Versions (Redis 6.2+ / Valkey 8.0+)
GETDEL: Obtains the value and then immediately deletes the key.
GETEX: Obtains the value and simultaneously sets or removes the expiration time.
LCS (Redis 7.0+): Calculates the longest common subsequence of two string values.
For more information, see the Valkey official documentation: String Command Group.

Command Support Overview

Basic Commands: append, decr, decrby, get, getrange, getset, incr, incrby, incrbyfloat, mget, mset, msetnx, psetex, setex, set, setnx, setrange, strlen. These commands are supported by the standard architecture of Redis versions 2.8, 4.0, 5.0, 6.2, and 7.0, as well as the standard and cluster architectures of Valkey versions 8.0 and 9.0.
Commands Added in Version 6.2+ (2 commands): getdel and getex. These commands are supported only by Redis versions 6.2 and 7.0, and Valkey versions 8.0 and 9.0.
Commands Added in Version 7.0+ (2 commands): lcs and stralgo. These commands are supported only by Redis version 7.0, and Valkey versions 8.0 and 9.0.
Cross-Slot Restriction: In a cluster architecture, mget and mset support cross-slot operations, whereas msetnx does not.

Command Compatibility Matrix

The support status of Strings family commands across different versions and architectures is shown in the table below (✓ indicates supported, ✗ indicates not supported, and — indicates that the command does not involve a cross-slot access scenario).
Note:
In Redis 7.0 and Valkey 8.0 and 9.0, the set command has been enhanced with the NX and GET parameters.
The lcs command is used to return the longest common subsequence of two Key values.
Command
Valkey 9.0 Standard Architecture
Valkey 9.0 Cluster Architecture
Redis 7.0/Valkey 8.0 Standard Architecture
Redis 7.0/Valkey 8.0 Cluster Architecture
Redis 6.2 Standard Architecture
Redis 6.2 Cluster Architecture
Redis 5.0 Standard Architecture
Redis 5.0 Cluster Architecture
Redis 4.0 Standard Architecture
Redis 4.0 Cluster Architecture
Redis 2.8 Standard Architecture
Cluster Architecture Cross-Slot Support
append

decr
decrby
get
getrange
getset
incr
incrby
incrbyfloat
mget
mset
msetnx
psetex
setex
set
setnx
setrange
strlen
stralgo
getdel
getex
lcs

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan