Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
506764b3
Commit
506764b3
authored
Jul 03, 2019
by
antirez
Browse files
Client side caching: hook inside call() for tracking.
parent
db16a861
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/server.c
View file @
506764b3
...
@@ -3194,6 +3194,7 @@ void call(client *c, int flags) {
...
@@ -3194,6 +3194,7 @@ void call(client *c, int flags) {
latencyAddSampleIfNeeded(latency_event,duration/1000);
latencyAddSampleIfNeeded(latency_event,duration/1000);
slowlogPushEntryIfNeeded(c,c->argv,c->argc,duration);
slowlogPushEntryIfNeeded(c,c->argv,c->argc,duration);
}
}
if (flags & CMD_CALL_STATS) {
if (flags & CMD_CALL_STATS) {
/* use the real command that was executed (cmd and lastamc) may be
/* use the real command that was executed (cmd and lastamc) may be
* different, in case of MULTI-EXEC or re-written commands such as
* different, in case of MULTI-EXEC or re-written commands such as
...
@@ -3261,6 +3262,16 @@ void call(client *c, int flags) {
...
@@ -3261,6 +3262,16 @@ void call(client *c, int flags) {
redisOpArrayFree(&server.also_propagate);
redisOpArrayFree(&server.also_propagate);
}
}
server.also_propagate = prev_also_propagate;
server.also_propagate = prev_also_propagate;
/* If the client has keys tracking enabled for client side caching,
* make sure to remember the keys it fetched via this command. */
if (c->cmd->flags & CMD_READONLY) {
client *caller = (c->flags & CLIENT_LUA && server.lua_caller) ?
server.lua_caller : c;
if (caller->flags & CLIENT_TRACKING)
trackingRememberKeys(caller);
}
server.stat_numcommands++;
server.stat_numcommands++;
}
}
...
...
src/server.h
View file @
506764b3
...
@@ -1617,6 +1617,7 @@ void addReplyStatusFormat(client *c, const char *fmt, ...);
...
@@ -1617,6 +1617,7 @@ void addReplyStatusFormat(client *c, const char *fmt, ...);
/* Client side caching (tracking mode) */
/* Client side caching (tracking mode) */
void
enableTracking
(
client
*
c
,
uint64_t
redirect_to
);
void
enableTracking
(
client
*
c
,
uint64_t
redirect_to
);
void
disableTracking
(
client
*
c
);
void
disableTracking
(
client
*
c
);
void
trackingRememberKeys
(
client
*
c
);
/* List data type */
/* List data type */
void
listTypeTryConversion
(
robj
*
subject
,
robj
*
value
);
void
listTypeTryConversion
(
robj
*
subject
,
robj
*
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment