Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpredis/phpredis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2019-03-19 19:37:21 +0300
committermichael-grunder <michael.grunder@gmail.com>2019-03-19 19:37:21 +0300
commit7e3d6f2238a8950053d69d9f322868df6dceb1eb (patch)
treec4c738327294586b82082c3bdde4a31ebdfc4804 /redis.c
parenteb81b9153cb34c7342ae7a0c7f9cba7eadd54c88 (diff)
parent63be9527be50a726caf3537ba50eb07d67391129 (diff)
Merge branch 'cluster-slot-cache' into issue.1448-require_php7
Diffstat (limited to 'redis.c')
-rw-r--r--redis.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/redis.c b/redis.c
index e7499adb..f0e386d9 100644
--- a/redis.c
+++ b/redis.c
@@ -50,6 +50,8 @@ extern zend_class_entry *redis_cluster_exception_ce;
zend_class_entry *redis_ce;
zend_class_entry *redis_exception_ce;
+extern int le_cluster_slot_cache;
+
extern zend_function_entry redis_array_functions[];
extern zend_function_entry redis_cluster_functions[];
@@ -71,6 +73,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("redis.arrays.consistent", "0", PHP_INI_ALL, NULL)
/* redis cluster */
+ PHP_INI_ENTRY("redis.clusters.cache_slots", "0", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.clusters.auth", "", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.clusters.persistent", "0", PHP_INI_ALL, NULL)
PHP_INI_ENTRY("redis.clusters.read_timeout", "0", PHP_INI_ALL, NULL)
@@ -555,6 +558,12 @@ free_reply_callbacks(RedisSock *redis_sock)
redis_sock->current = NULL;
}
+/* Passthru for destroying cluster cache */
+static void cluster_cache_dtor(zend_resource *rsrc) {
+ redisCachedCluster *rcc = (redisCachedCluster*)rsrc->ptr;
+ cluster_cache_free(rcc);
+}
+
void
free_redis_object(zend_object *object)
{
@@ -737,6 +746,10 @@ PHP_MINIT_FUNCTION(redis)
redis_cluster_ce = zend_register_internal_class(&redis_cluster_class_entry TSRMLS_CC);
redis_cluster_ce->create_object = create_cluster_context;
+ /* Register our cluster cache list item */
+ le_cluster_slot_cache = zend_register_list_destructors_ex(NULL, cluster_cache_dtor,
+ "Redis cluster slot cache",
+ module_number);
/* Base Exception class */
#if HAVE_SPL