Managing Client Connections
1. Listing Connected Clients
| Command | Returns |
|---|---|
CLIENT LIST [TYPE normal|master|replica|pubsub] [ID id ...] | Per-client info |
2. Getting Client Name
| Command | Description |
|---|---|
CLIENT GETNAME | Returns current connection's name |
3. Setting Client Name
| Command | Description |
|---|---|
CLIENT SETNAME name | Tag connection for debugging |
CLIENT SETINFO LIB-NAME|LIB-VER v | Library identification 7.2+ |
4. Getting Client Info
| Command | Returns |
|---|---|
CLIENT INFO | Single-line info about current connection |
5. Using CLIENT ID for Tracking
| Command | Description |
|---|---|
CLIENT ID | Unique 64-bit per-connection id |
6. Killing Client Connections
| Filter | Example |
|---|---|
ADDR ip:port | CLIENT KILL ADDR 1.2.3.4:5555 |
ID id | CLIENT KILL ID 42 |
USER name | Kill all of a user's sessions |
TYPE normal|pubsub|master|replica | Mass kill by type |
SKIPME no | Include current connection |
MAXAGE seconds | Kill connections older than N 7.4+ |
7. Pausing All Clients
| Command | Description |
|---|---|
CLIENT PAUSE ms [WRITE|ALL] | Block clients for N ms (operations queue) |
CLIENT UNPAUSE | Resume |
8. Unblocking Clients
| Command | Description |
|---|---|
CLIENT UNBLOCK id [TIMEOUT|ERROR] | Release blocked client |
9. Using CLIENT NO-EVICT
| Command | Description |
|---|---|
CLIENT NO-EVICT ON|OFF | Exempt connection from output-buffer evictions 7.0+ |
10. Using CLIENT NO-TOUCH
| Command | Description |
|---|---|
CLIENT NO-TOUCH ON|OFF | Don't update LRU/LFU on access 7.2+ |
11. Tracking Client Side Caching
| Command | Description |
|---|---|
CLIENT TRACKING ON [REDIRECT id] [BCAST] [PREFIX p] [OPTIN] [OPTOUT] [NOLOOP] | Server-assisted client cache invalidation |
CLIENT TRACKING OFF | Disable |
CLIENT TRACKINGINFO | Current tracking state |
CLIENT CACHING YES|NO | Per-command opt-in (with OPTIN mode) |
12. Implementing Client-Side Caching Invalidation
Example: BCAST tracking with prefix
CLIENT TRACKING ON BCAST PREFIX user: REDIRECT 7
# Invalidations arrive on connection 7 as __redis__:invalidate
| Mode | Description |
|---|---|
| Default (key) | Track each key client read |
| BCAST | Notify by prefix; no per-key tracking |