Skip to content

Commit 6415f3a

Browse files
committed
CLIENT CACHING documented.
1 parent 4269446 commit 6415f3a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

commands.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,22 @@
361361
"since": "5.0.0",
362362
"group": "sorted_set"
363363
},
364+
"CLIENT CACHING": {
365+
"summary": "Instruct the server about tracking or not keys in the next request",
366+
"complexity": "O(1)",
367+
"arguments": [
368+
{
369+
"name": "mode",
370+
"type": "enum",
371+
"enum": [
372+
"YES",
373+
"NO"
374+
]
375+
}
376+
],
377+
"since": "6.0.0",
378+
"group": "server"
379+
},
364380
"CLIENT ID": {
365381
"summary": "Returns the client ID for the current connection",
366382
"complexity": "O(1)",

commands/client-caching.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
This command controls the tracking of the keys in the next command executed
2+
by the connection, when tracking is enabled in `OPTIN` or `OPTOUT` mode.
3+
Please check the
4+
[client side caching documentation](/topics/client-side-caching) for
5+
background informations.
6+
7+
When tracking is enabled Redis, using the `CLIENT TRACKING` command, it is
8+
possible to specify the `OPTIN` or `OPTOUT` options, so that keys
9+
in read only commands are not automatically remembered by the server to
10+
be invalidated later. When we are in `OPTIN` mode, we can enable the
11+
tracking of the keys in the next command by calling `CLIENT CACHING yes`
12+
immediately before it. Similarly when we are in `OPTOUT` mode, and keys
13+
are normally tracked, we can avoid the keys in the next command to be
14+
tracked using `CLIENT CACHING no`.
15+
16+
Basically the command sets a state in the connection, that is valid only
17+
for the next command execution, that will modify the behavior of client
18+
tracking.
19+
20+
@return
21+
22+
@simple-string-reply: `OK` or an error if the argument is not yes or no.

0 commit comments

Comments
 (0)