CLIENT TRACKINGINFO
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.
Return value
Section titled “Return value”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. |
Examples
Section titled “Examples”Tracking off, on a RESP2 connection:
127.0.0.1:6379> CLIENT TRACKINGINFO1) "flags"2) 1) "off"3) "redirect"4) (integer) -15) "prefixes"6) (empty array)In OPTOUT mode, with the next command left out:
127.0.0.1:6379> CLIENT TRACKING ON OPTOUT NOLOOPOK127.0.0.1:6379> CLIENT CACHING NOOK127.0.0.1:6379> CLIENT TRACKINGINFO1) "flags"2) 1) "on" 2) "optout" 3) "caching-no" 4) "noloop"3) "redirect"4) (integer) 05) "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:OK127.0.0.1:6379> CLIENT TRACKING ON BCAST PREFIX cart:OK127.0.0.1:6379> CLIENT TRACKINGINFO1) "flags"2) 1) "on" 2) "bcast"3) "redirect"4) (integer) 05) "prefixes"6) 1) "cart:" 2) "order:" 3) "user:"Compatibility
Section titled “Compatibility”The same reply shape, flags and order as Redis 8 and Valkey 9.
See also
Section titled “See also”CLIENT TRACKING, CLIENT GETREDIR, CLIENT CACHING, CLIENT LIST
Was this page helpful?
Thanks for the feedback.