GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Invalidate slot cache on failed cluster connections · phpredis/phpredis@c7b8784

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • cluster_library.c
  • cluster_library.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎cluster_library.c‎

Copy file name to clipboardExpand all lines: cluster_library.c
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,11 +1599,13 @@ PHP_REDIS_API short cluster_send_command(redisCluster *c, short slot, const char
15991599

16001600
// If we've detected the cluster is down, throw an exception
16011601
if (c->clusterdown) {
1602+
cluster_cache_clear(c);
16021603
CLUSTER_THROW_EXCEPTION("The Redis Cluster is down (CLUSTERDOWN)", 0);
16031604
return -1;
16041605
} else if (timedout || resp == -1) {
16051606
// Make sure the socket is reconnected, it such that it is in a clean state
16061607
redis_sock_disconnect(c->cmd_sock, 1, 1);
1608+
cluster_cache_clear(c);
16071609

16081610
if (timedout) {
16091611
CLUSTER_THROW_EXCEPTION("Timed out attempting to find data in the correct node!", 0);
@@ -3115,5 +3117,12 @@ PHP_REDIS_API void cluster_cache_store(zend_string *hash, HashTable *nodes) {
31153117
redis_register_persistent_resource(cc->hash, cc, le_cluster_slot_cache);
31163118
}
31173119

3120+
void cluster_cache_clear(redisCluster *c)
3121+
{
3122+
if (c->cache_key) {
3123+
zend_hash_del(&EG(persistent_list), c->cache_key);
3124+
}
3125+
}
3126+
31183127

31193128
/* vim: set tabstop=4 softtabstop=4 expandtab shiftwidth=4: */
Collapse file

‎cluster_library.h‎

Copy file name to clipboardExpand all lines: cluster_library.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ PHP_REDIS_API char **cluster_sock_read_multibulk_reply(RedisSock *redis_sock, in
390390

391391
PHP_REDIS_API void cluster_cache_store(zend_string *hash, HashTable *nodes);
392392
PHP_REDIS_API redisCachedCluster *cluster_cache_load(zend_string *hash);
393+
void cluster_cache_clear(redisCluster *c);
393394

394395
/*
395396
* Redis Cluster response handlers. Our response handlers generally take the

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.