@@ -1765,7 +1765,6 @@ PHP_METHOD(Memcached, setByKey)
1765
1765
}
1766
1766
/* }}} */
1767
1767
1768
- #ifdef HAVE_MEMCACHED_TOUCH
1769
1768
/* {{{ Memcached::touch(string key, [, int expiration ])
1770
1769
Sets a new expiration for the given key */
1771
1770
PHP_METHOD (Memcached , touch )
@@ -1781,8 +1780,6 @@ PHP_METHOD(Memcached, touchByKey)
1781
1780
php_memc_store_impl (INTERNAL_FUNCTION_PARAM_PASSTHRU , MEMC_OP_TOUCH , 1 );
1782
1781
}
1783
1782
/* }}} */
1784
- #endif
1785
-
1786
1783
1787
1784
/* {{{ Memcached::setMulti(array items [, int expiration ])
1788
1785
Sets the keys/values specified in the items array */
@@ -2322,17 +2319,7 @@ PHP_METHOD(Memcached, addServer)
2322
2319
MEMC_METHOD_FETCH_OBJECT ;
2323
2320
s_memc_set_status (intern , MEMCACHED_SUCCESS , 0 );
2324
2321
2325
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX < 0x01000002
2326
- if (ZSTR_VAL (host )[0 ] == '/' ) { /* unix domain socket */
2327
- status = memcached_server_add_unix_socket_with_weight (intern -> memc , ZSTR_VAL (host ), weight );
2328
- } else if (memcached_behavior_get (intern -> memc , MEMCACHED_BEHAVIOR_USE_UDP )) {
2329
- status = memcached_server_add_udp_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2330
- } else {
2331
- status = memcached_server_add_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2332
- }
2333
- #else
2334
2322
status = memcached_server_add_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2335
- #endif
2336
2323
2337
2324
if (s_memc_status_handle_result_code (intern , status ) == FAILURE ) {
2338
2325
RETURN_FALSE ;
@@ -2528,7 +2515,6 @@ PHP_METHOD(Memcached, flushBuffers)
2528
2515
}
2529
2516
/* }}} */
2530
2517
2531
- #ifdef HAVE_LIBMEMCACHED_CHECK_CONFIGURATION
2532
2518
/* {{{ Memcached::getLastErrorMessage()
2533
2519
Returns the last error message that occurred */
2534
2520
PHP_METHOD (Memcached , getLastErrorMessage )
@@ -2576,7 +2562,6 @@ PHP_METHOD(Memcached, getLastErrorErrno)
2576
2562
RETURN_LONG (memcached_last_error_errno (intern -> memc ));
2577
2563
}
2578
2564
/* }}} */
2579
- #endif
2580
2565
2581
2566
/* {{{ Memcached::getLastDisconnectedServer()
2582
2567
Returns the last disconnected server
@@ -2816,11 +2801,7 @@ static PHP_METHOD(Memcached, getOption)
2816
2801
2817
2802
result = memcached_callback_get (intern -> memc , MEMCACHED_CALLBACK_PREFIX_KEY , & retval );
2818
2803
if (retval == MEMCACHED_SUCCESS && result ) {
2819
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2820
- RETURN_STRINGL (result , strlen (result ));
2821
- #else
2822
2804
RETURN_STRING (result );
2823
- #endif
2824
2805
} else {
2825
2806
RETURN_EMPTY_STRING ();
2826
2807
}
@@ -2885,23 +2866,11 @@ int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)
2885
2866
{
2886
2867
zend_string * str ;
2887
2868
char * key ;
2888
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2889
- char tmp [MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 ];
2890
- #endif
2891
2869
str = zval_get_string (value );
2892
2870
if (ZSTR_LEN (str ) == 0 ) {
2893
2871
key = NULL ;
2894
2872
} else {
2895
- /*
2896
- work-around a bug in libmemcached in version 0.49 that truncates the trailing
2897
- character of the key prefix, to avoid the issue we pad it with a '0'
2898
- */
2899
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2900
- snprintf (tmp , sizeof (tmp ), "%s0" , ZSTR_VAL (str ));
2901
- key = tmp ;
2902
- #else
2903
2873
key = ZSTR_VAL (str );
2904
- #endif
2905
2874
}
2906
2875
if (memcached_callback_set (intern -> memc , MEMCACHED_CALLBACK_PREFIX_KEY , key ) == MEMCACHED_BAD_KEY_PROVIDED ) {
2907
2876
zend_string_release (str );
@@ -2930,14 +2899,9 @@ int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)
2930
2899
* (non-weighted) case. We have to clean up ourselves.
2931
2900
*/
2932
2901
if (!lval ) {
2933
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX > 0x00037000
2934
- (void )memcached_behavior_set_key_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2935
- (void )memcached_behavior_set_distribution_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2936
- (void )memcached_behavior_set_distribution (intern -> memc , MEMCACHED_DISTRIBUTION_MODULA );
2937
- #else
2938
- intern -> memc -> hash = 0 ;
2939
- intern -> memc -> distribution = 0 ;
2940
- #endif
2902
+ (void )memcached_behavior_set_key_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2903
+ (void )memcached_behavior_set_distribution_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2904
+ (void )memcached_behavior_set_distribution (intern -> memc , MEMCACHED_DISTRIBUTION_MODULA );
2941
2905
}
2942
2906
break ;
2943
2907
@@ -4020,10 +3984,10 @@ static zend_function_entry memcached_class_methods[] = {
4020
3984
4021
3985
MEMC_ME (set , arginfo_set )
4022
3986
MEMC_ME (setByKey , arginfo_setByKey )
4023
- #ifdef HAVE_MEMCACHED_TOUCH
3987
+
4024
3988
MEMC_ME (touch , arginfo_touch )
4025
3989
MEMC_ME (touchByKey , arginfo_touchByKey )
4026
- #endif
3990
+
4027
3991
MEMC_ME (setMulti , arginfo_setMulti )
4028
3992
MEMC_ME (setMultiByKey , arginfo_setMultiByKey )
4029
3993
@@ -4055,11 +4019,9 @@ static zend_function_entry memcached_class_methods[] = {
4055
4019
MEMC_ME (quit , arginfo_quit )
4056
4020
MEMC_ME (flushBuffers , arginfo_flushBuffers )
4057
4021
4058
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
4059
4022
MEMC_ME (getLastErrorMessage , arginfo_getLastErrorMessage )
4060
4023
MEMC_ME (getLastErrorCode , arginfo_getLastErrorCode )
4061
4024
MEMC_ME (getLastErrorErrno , arginfo_getLastErrorErrno )
4062
- #endif
4063
4025
MEMC_ME (getLastDisconnectedServer , arginfo_getLastDisconnectedServer )
4064
4026
4065
4027
MEMC_ME (getStats , arginfo_getStats )
@@ -4252,9 +4214,7 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
4252
4214
REGISTER_MEMC_CLASS_CONST_LONG (OPT_DISTRIBUTION , MEMCACHED_BEHAVIOR_DISTRIBUTION );
4253
4215
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_MODULA , MEMCACHED_DISTRIBUTION_MODULA );
4254
4216
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_CONSISTENT , MEMCACHED_DISTRIBUTION_CONSISTENT );
4255
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
4256
4217
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_VIRTUAL_BUCKET , MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET );
4257
- #endif
4258
4218
REGISTER_MEMC_CLASS_CONST_LONG (OPT_LIBKETAMA_COMPATIBLE , MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED );
4259
4219
REGISTER_MEMC_CLASS_CONST_LONG (OPT_LIBKETAMA_HASH , MEMCACHED_BEHAVIOR_KETAMA_HASH );
4260
4220
REGISTER_MEMC_CLASS_CONST_LONG (OPT_TCP_KEEPALIVE , MEMCACHED_BEHAVIOR_TCP_KEEPALIVE );
@@ -4280,14 +4240,10 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
4280
4240
REGISTER_MEMC_CLASS_CONST_LONG (OPT_SORT_HOSTS , MEMCACHED_BEHAVIOR_SORT_HOSTS );
4281
4241
REGISTER_MEMC_CLASS_CONST_LONG (OPT_VERIFY_KEY , MEMCACHED_BEHAVIOR_VERIFY_KEY );
4282
4242
REGISTER_MEMC_CLASS_CONST_LONG (OPT_USE_UDP , MEMCACHED_BEHAVIOR_USE_UDP );
4283
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00037000
4284
4243
REGISTER_MEMC_CLASS_CONST_LONG (OPT_NUMBER_OF_REPLICAS , MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS );
4285
4244
REGISTER_MEMC_CLASS_CONST_LONG (OPT_RANDOMIZE_REPLICA_READ , MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ );
4286
- #endif
4287
- #ifdef HAVE_MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS
4288
4245
REGISTER_MEMC_CLASS_CONST_LONG (OPT_REMOVE_FAILED_SERVERS , MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS );
4289
- #endif
4290
- #ifdef HAVE_MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT
4246
+ #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x01000018
4291
4247
REGISTER_MEMC_CLASS_CONST_LONG (OPT_SERVER_TIMEOUT_LIMIT , MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT );
4292
4248
#endif
4293
4249
0 commit comments