Skip to content

Commit 761fc79

Browse files
author
Nicolas Van Eenaeme
committed
Added ini setting for memcached.store_retry_count
1 parent 1cbaeef commit 761fc79

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

memcached.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,9 @@ memcached.serializer = "igbinary"
109109
; the default is Off
110110
memcached.use_sasl = Off
111111

112+
; The amount of retries for failed store commands.
113+
; This mechanism allows transparent fail-over to secondary servers when
114+
; set/increment/decrement/setMulti operations fail on the desired server in a multi-server
115+
; environment.
116+
; the default is 2
117+
memcached.store_retry_count = 2

php_memcached.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ PHP_INI_BEGIN()
317317
#if HAVE_MEMCACHED_SASL
318318
STD_PHP_INI_ENTRY("memcached.use_sasl", "0", PHP_INI_SYSTEM, OnUpdateBool, use_sasl, zend_php_memcached_globals, php_memcached_globals)
319319
#endif
320+
STD_PHP_INI_ENTRY("memcached.store_retry_count", "2", PHP_INI_ALL, OnUpdateLong, store_retry_count, zend_php_memcached_globals, php_memcached_globals)
320321
PHP_INI_END()
321322
/* }}} */
322323

@@ -467,7 +468,7 @@ static PHP_METHOD(Memcached, __construct)
467468
m_obj->serializer = MEMC_G(serializer);
468469
m_obj->compression_type = MEMC_G(compression_type_real);
469470
m_obj->compression = 1;
470-
m_obj->store_retry_count = 2;
471+
m_obj->store_retry_count = MEMC_G(store_retry_count);
471472

472473
i_obj->obj = m_obj;
473474
i_obj->is_pristine = 1;
@@ -3201,6 +3202,7 @@ static void php_memc_init_globals(zend_php_memcached_globals *php_memcached_glob
32013202
#if HAVE_MEMCACHED_SASL
32023203
MEMC_G(use_sasl) = 0;
32033204
#endif
3205+
MEMC_G(store_retry_count) = 2;
32043206
}
32053207

32063208
static void php_memc_destroy_globals(zend_php_memcached_globals *php_memcached_globals_p TSRMLS_DC)

php_memcached.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ ZEND_BEGIN_MODULE_GLOBALS(php_memcached)
9393
#if HAVE_MEMCACHED_SASL
9494
bool use_sasl;
9595
#endif
96+
int store_retry_count;
9697
ZEND_END_MODULE_GLOBALS(php_memcached)
9798

9899
PHP_MEMCACHED_API zend_class_entry *php_memc_get_ce(void);

0 commit comments

Comments
 (0)