diff options
author | michael-grunder <michael.grunder@gmail.com> | 2019-02-10 04:02:15 +0300 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2019-02-10 04:02:15 +0300 |
commit | a08d51fa3eb516458715c29d35d93fdb68f5ed68 (patch) | |
tree | 435d8b0db721e95ffcd7b6bf04afb493d8e46db7 /cluster_library.c | |
parent | c7c9a92118a244fb137e7a8381128444fd9d3100 (diff) |
Attach slot cache key and mechanism for invalidation
Diffstat (limited to 'cluster_library.c')
-rw-r--r-- | cluster_library.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cluster_library.c b/cluster_library.c index 6a822067..cc1ef16e 100644 --- a/cluster_library.c +++ b/cluster_library.c @@ -1021,6 +1021,9 @@ void cluster_init_cache(redisCluster *c, redisCachedCluster *cc) { /* Iterate over masters */ for (i = 0; i < cc->count; i++) { + /* Attach cache key */ + c->cache_key = cc->hash; + /* Grab the next master */ cm = &cc->master[map[i]]; @@ -1215,8 +1218,10 @@ static int cluster_check_response(redisCluster *c, REDIS_REPLY_TYPE *reply_type } // Check for MOVED or ASK redirection - if ((moved = IS_MOVED(inbuf)) || IS_ASK(inbuf)) { - // Set our redirection information + if ((moved = IS_MOVED(inbuf)) || IS_ASK(inbuf)) { // Set our redirection information + /* We'll want to invalidate slot cache if we're using one */ + c->redirections++; + if (cluster_set_redirection(c,inbuf,moved) < 0) { return -1; } @@ -1543,7 +1548,7 @@ PHP_REDIS_API int cluster_send_slot(redisCluster *c, short slot, char *cmd, /* Send a command to given slot in our cluster. If we get a MOVED or ASK error * we attempt to send the command to the node as directed. */ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char *cmd, - int cmd_len TSRMLS_DC) + int cmd_len TSRMLS_DC) { int resp, timedout = 0; long msstart; |