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:
authorEmmanuel Merali <emmanuel@mobli.com>2013-02-25 02:38:47 +0400
committerEmmanuel Merali <emmanuel@mobli.com>2013-02-25 02:38:47 +0400
commitacd324545685e3368bd8d9c626e7e019d4cdeb79 (patch)
treef9bba2226073d4c8c6eb5c8014476e70786f8710 /redis.c
parent4ae635fddf7839c0e8282bcaa36bada2756eeacd (diff)
Added lazy_connect option to RedisArray
Added an option to let each RedisArray connection connect lazily to their respective server. This is useful then working with a redis cluster composed of many shards which are not necessarily in use all at once.
Diffstat (limited to 'redis.c')
-rw-r--r--redis.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/redis.c b/redis.c
index 4e514e87..1a1bb508 100644
--- a/redis.c
+++ b/redis.c
@@ -377,6 +377,13 @@ PHPAPI int redis_sock_get(zval *id, RedisSock **redis_sock TSRMLS_DC, int no_thr
}
return -1;
}
+ if ((*redis_sock)->lazy_connect)
+ {
+ (*redis_sock)->lazy_connect = 0;
+ if (redis_sock_server_open(*redis_sock, 1 TSRMLS_CC) < 0) {
+ return -1;
+ }
+ }
return Z_LVAL_PP(socket);
}
@@ -603,7 +610,7 @@ PHPAPI int redis_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) {
zend_clear_exception(TSRMLS_C); /* clear exception triggered by non-existent socket during connect(). */
}
- redis_sock = redis_sock_create(host, host_len, port, timeout, persistent, persistent_id, retry_interval);
+ redis_sock = redis_sock_create(host, host_len, port, timeout, persistent, persistent_id, retry_interval, 0);
if (redis_sock_server_open(redis_sock, 1 TSRMLS_CC) < 0) {
redis_free_socket(redis_sock);