mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
Client side caching: hook inside call() for tracking.
This commit is contained in:
parent
db16a861a1
commit
506764b3f8
11
src/server.c
11
src/server.c
@ -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) {
|
|||||||
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++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user