@@ -104,6 +104,7 @@ ZEND_END_ARG_INFO()
104104zend_function_entry redis_array_functions [] = {
105105 PHP_ME (RedisArray , __call , arginfo_call , ZEND_ACC_PUBLIC )
106106 PHP_ME (RedisArray , __construct , arginfo_ctor , ZEND_ACC_PUBLIC )
107+ PHP_ME (RedisArray , _continuum , arginfo_void , ZEND_ACC_PUBLIC )
107108 PHP_ME (RedisArray , _distributor , arginfo_void , ZEND_ACC_PUBLIC )
108109 PHP_ME (RedisArray , _function , arginfo_void , ZEND_ACC_PUBLIC )
109110 PHP_ME (RedisArray , _hosts , arginfo_void , ZEND_ACC_PUBLIC )
@@ -639,6 +640,38 @@ PHP_METHOD(RedisArray, _rehash)
639640 }
640641}
641642
643+ PHP_METHOD (RedisArray , _continuum )
644+ {
645+ int i ;
646+ zval * object ;
647+ RedisArray * ra ;
648+
649+ if (zend_parse_method_parameters (ZEND_NUM_ARGS () TSRMLS_CC , getThis (), "O" ,
650+ & object , redis_array_ce ) == FAILURE ) {
651+ RETURN_FALSE ;
652+ }
653+
654+ if ((ra = redis_array_get (object TSRMLS_CC )) == NULL ) {
655+ RETURN_FALSE ;
656+ }
657+
658+ array_init (return_value );
659+ if (ra -> continuum ) {
660+ for (i = 0 ; i < ra -> continuum -> nb_points ; ++ i ) {
661+ zval zv , * z_tmp = & zv ;
662+ #if (PHP_MAJOR_VERSION < 7 )
663+ MAKE_STD_ZVAL (z_tmp );
664+ #endif
665+
666+ array_init (z_tmp );
667+ add_assoc_long (z_tmp , "index" , ra -> continuum -> points [i ].index );
668+ add_assoc_long (z_tmp , "value" , ra -> continuum -> points [i ].value );
669+ add_next_index_zval (return_value , z_tmp );
670+ }
671+ }
672+ }
673+
674+
642675static void
643676multihost_distribute_call (RedisArray * ra , zval * return_value , zval * z_fun , int argc , zval * argv TSRMLS_DC )
644677{
0 commit comments