# CLIENT GETREDIR

> Return the id of the connection that receives this connection's client-side caching invalidations.

URL: https://docs.hotkv.com/commands/client-getredir/

```
CLIENT GETREDIR
```

- Group: Connection
- Complexity: O(1)
- HotKV Cloud: all plans
- On-Premise: no license needed

`CLIENT GETREDIR` returns where the invalidations of this connection go, as set by
the `REDIRECT` option of [CLIENT TRACKING](https://docs.hotkv.com/commands/client-tracking/index.md).

## Return value

An integer, in RESP2 and RESP3:

| Reply | Meaning |
| --- | --- |
| `-1` | Tracking is off. |
| `0` | Tracking is on and the invalidations come to this connection. |
| Another number | The id of the connection they are redirected to. |

The number is the id the redirect was set to, also after that connection has
closed. [CLIENT TRACKINGINFO](https://docs.hotkv.com/commands/client-trackinginfo/index.md) lists
`broken_redirect` among the flags when it has.

## Examples

```
127.0.0.1:6379> CLIENT GETREDIR
(integer) -1
127.0.0.1:6379> CLIENT TRACKING ON
OK
127.0.0.1:6379> CLIENT GETREDIR
(integer) 0
```

## Compatibility

Same replies as Redis 8 and Valkey 9.

## See also

[CLIENT TRACKING](https://docs.hotkv.com/commands/client-tracking/index.md),
[CLIENT TRACKINGINFO](https://docs.hotkv.com/commands/client-trackinginfo/index.md),
[CLIENT ID](https://docs.hotkv.com/commands/client-id/index.md)