@@ -152,9 +152,10 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
152152 zval * z_params_prev , * * z_prev ;
153153 zval * z_params_funs , * * z_data_pp , * z_fun = NULL ;
154154 zval * z_params_index ;
155+ zval * z_params_autorehash ;
155156 RedisArray * ra = NULL ;
156157
157- zend_bool b_index = 0 ;
158+ zend_bool b_index = 0 , b_autorehash = 0 ;
158159 HashTable * hHosts = NULL , * hPrev = NULL ;
159160
160161 /* find entry */
@@ -197,8 +198,19 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
197198 }
198199 }
199200
201+ /* find autorehash option */
202+ MAKE_STD_ZVAL (z_params_autorehash );
203+ array_init (z_params_autorehash );
204+ sapi_module .treat_data (PARSE_STRING , estrdup (INI_STR ("redis.arrays.autorehash" )), z_params_autorehash TSRMLS_CC );
205+ if (zend_hash_find (Z_ARRVAL_P (z_params_autorehash ), name , strlen (name ) + 1 , (void * * ) & z_data_pp ) != FAILURE ) {
206+ if (Z_TYPE_PP (z_data_pp ) == IS_STRING && strncmp (Z_STRVAL_PP (z_data_pp ), "1" , 1 ) == 0 ) {
207+ b_autorehash = 1 ;
208+ }
209+ }
210+
200211 /* create RedisArray object */
201212 ra = ra_make_array (hHosts , z_fun , hPrev , b_index TSRMLS_CC );
213+ ra -> auto_rehash = b_autorehash ;
202214
203215 /* cleanup */
204216 zval_dtor (z_params_hosts );
@@ -209,6 +221,8 @@ RedisArray *ra_load_array(const char *name TSRMLS_DC) {
209221 efree (z_params_funs );
210222 zval_dtor (z_params_index );
211223 efree (z_params_index );
224+ zval_dtor (z_params_autorehash );
225+ efree (z_params_autorehash );
212226
213227 return ra ;
214228}
@@ -760,7 +774,7 @@ ra_move_list(const char *key, int key_len, zval *z_from, zval *z_to TSRMLS_DC) {
760774 return ra_move_collection (key , key_len , z_from , z_to , 3 , cmd_list , 1 , cmd_add TSRMLS_CC );
761775}
762776
763- static void
777+ void
764778ra_move_key (const char * key , int key_len , zval * z_from , zval * z_to TSRMLS_DC ) {
765779
766780 long type = ra_get_key_type (z_from , key , key_len TSRMLS_CC );
0 commit comments