Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

CLIENT TRACKINGINFO

Last updated
CLIENT TRACKINGINFO
Group
Connection
Complexity
O(N) where N is the number of prefixes
Arity
2 (exactly, counting the command name)
HotKV Cloud
All plans
On-Premise
no license needed

CLIENT TRACKINGINFO reports the state that CLIENT TRACKING gave the current connection. Client libraries read it to check how tracking is set up before they rely on it.

Three fields: a map in RESP3, a flat array of field and value pairs in RESP2.

Field Value
flags A set (an array in RESP2) of strings, see below.
redirect -1 when tracking is off, 0 when invalidations come to this connection, else the id of the connection they go to.
prefixes The BCAST prefixes, sorted by their bytes. Empty outside BCAST.

The flags:

Flag Meaning
off Tracking is off. It is the only flag then.
on Tracking is on.
bcast BCAST mode.
optin, optout The mode the connection chose.
caching-yes, caching-no A CLIENT CACHING is waiting for the next command (with optin or optout).
noloop NOLOOP was given.
broken_redirect The connection redirected to has closed.

Tracking off, on a RESP2 connection:

127.0.0.1:6379> CLIENT TRACKINGINFO
1) "flags"
2) 1) "off"
3) "redirect"
4) (integer) -1
5) "prefixes"
6) (empty array)

In OPTOUT mode, with the next command left out:

127.0.0.1:6379> CLIENT TRACKING ON OPTOUT NOLOOP
OK
127.0.0.1:6379> CLIENT CACHING NO
OK
127.0.0.1:6379> CLIENT TRACKINGINFO
1) "flags"
2) 1) "on"
2) "optout"
3) "caching-no"
4) "noloop"
3) "redirect"
4) (integer) 0
5) "prefixes"
6) (empty array)

Broadcasting three prefixes, which are listed in byte order whatever order they were given in:

127.0.0.1:6379> CLIENT TRACKING ON BCAST PREFIX user: PREFIX order:
OK
127.0.0.1:6379> CLIENT TRACKING ON BCAST PREFIX cart:
OK
127.0.0.1:6379> CLIENT TRACKINGINFO
1) "flags"
2) 1) "on"
2) "bcast"
3) "redirect"
4) (integer) 0
5) "prefixes"
6) 1) "cart:"
2) "order:"
3) "user:"

The same reply shape, flags and order as Redis 8 and Valkey 9.

CLIENT TRACKING, CLIENT GETREDIR, CLIENT CACHING, CLIENT LIST