@@ -1753,7 +1753,6 @@ PHP_METHOD(Memcached, setByKey)
1753
1753
}
1754
1754
/* }}} */
1755
1755
1756
- #ifdef HAVE_MEMCACHED_TOUCH
1757
1756
/* {{{ Memcached::touch(string key, [, int expiration ])
1758
1757
Sets a new expiration for the given key */
1759
1758
PHP_METHOD (Memcached , touch )
@@ -1769,8 +1768,6 @@ PHP_METHOD(Memcached, touchByKey)
1769
1768
php_memc_store_impl (INTERNAL_FUNCTION_PARAM_PASSTHRU , MEMC_OP_TOUCH , 1 );
1770
1769
}
1771
1770
/* }}} */
1772
- #endif
1773
-
1774
1771
1775
1772
/* {{{ Memcached::setMulti(array items [, int expiration ])
1776
1773
Sets the keys/values specified in the items array */
@@ -2305,17 +2302,7 @@ PHP_METHOD(Memcached, addServer)
2305
2302
MEMC_METHOD_FETCH_OBJECT ;
2306
2303
s_memc_set_status (intern , MEMCACHED_SUCCESS , 0 );
2307
2304
2308
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX < 0x01000002
2309
- if (ZSTR_VAL (host )[0 ] == '/' ) { /* unix domain socket */
2310
- status = memcached_server_add_unix_socket_with_weight (intern -> memc , ZSTR_VAL (host ), weight );
2311
- } else if (memcached_behavior_get (intern -> memc , MEMCACHED_BEHAVIOR_USE_UDP )) {
2312
- status = memcached_server_add_udp_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2313
- } else {
2314
- status = memcached_server_add_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2315
- }
2316
- #else
2317
2305
status = memcached_server_add_with_weight (intern -> memc , ZSTR_VAL (host ), port , weight );
2318
- #endif
2319
2306
2320
2307
if (s_memc_status_handle_result_code (intern , status ) == FAILURE ) {
2321
2308
RETURN_FALSE ;
@@ -2511,7 +2498,6 @@ PHP_METHOD(Memcached, flushBuffers)
2511
2498
}
2512
2499
/* }}} */
2513
2500
2514
- #ifdef HAVE_LIBMEMCACHED_CHECK_CONFIGURATION
2515
2501
/* {{{ Memcached::getLastErrorMessage()
2516
2502
Returns the last error message that occurred */
2517
2503
PHP_METHOD (Memcached , getLastErrorMessage )
@@ -2559,7 +2545,6 @@ PHP_METHOD(Memcached, getLastErrorErrno)
2559
2545
RETURN_LONG (memcached_last_error_errno (intern -> memc ));
2560
2546
}
2561
2547
/* }}} */
2562
- #endif
2563
2548
2564
2549
/* {{{ Memcached::getLastDisconnectedServer()
2565
2550
Returns the last disconnected server
@@ -2794,11 +2779,7 @@ static PHP_METHOD(Memcached, getOption)
2794
2779
2795
2780
result = memcached_callback_get (intern -> memc , MEMCACHED_CALLBACK_PREFIX_KEY , & retval );
2796
2781
if (retval == MEMCACHED_SUCCESS && result ) {
2797
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2798
- RETURN_STRINGL (result , strlen (result ));
2799
- #else
2800
2782
RETURN_STRING (result );
2801
- #endif
2802
2783
} else {
2803
2784
RETURN_EMPTY_STRING ();
2804
2785
}
@@ -2863,23 +2844,11 @@ int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)
2863
2844
{
2864
2845
zend_string * str ;
2865
2846
char * key ;
2866
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2867
- char tmp [MEMCACHED_PREFIX_KEY_MAX_SIZE - 1 ];
2868
- #endif
2869
2847
str = zval_get_string (value );
2870
2848
if (ZSTR_LEN (str ) == 0 ) {
2871
2849
key = NULL ;
2872
2850
} else {
2873
- /*
2874
- work-around a bug in libmemcached in version 0.49 that truncates the trailing
2875
- character of the key prefix, to avoid the issue we pad it with a '0'
2876
- */
2877
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX == 0x00049000
2878
- snprintf (tmp , sizeof (tmp ), "%s0" , ZSTR_VAL (str ));
2879
- key = tmp ;
2880
- #else
2881
2851
key = ZSTR_VAL (str );
2882
- #endif
2883
2852
}
2884
2853
if (memcached_callback_set (intern -> memc , MEMCACHED_CALLBACK_PREFIX_KEY , key ) == MEMCACHED_BAD_KEY_PROVIDED ) {
2885
2854
zend_string_release (str );
@@ -2908,14 +2877,9 @@ int php_memc_set_option(php_memc_object_t *intern, long option, zval *value)
2908
2877
* (non-weighted) case. We have to clean up ourselves.
2909
2878
*/
2910
2879
if (!lval ) {
2911
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX > 0x00037000
2912
- (void )memcached_behavior_set_key_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2913
- (void )memcached_behavior_set_distribution_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2914
- (void )memcached_behavior_set_distribution (intern -> memc , MEMCACHED_DISTRIBUTION_MODULA );
2915
- #else
2916
- intern -> memc -> hash = 0 ;
2917
- intern -> memc -> distribution = 0 ;
2918
- #endif
2880
+ (void )memcached_behavior_set_key_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2881
+ (void )memcached_behavior_set_distribution_hash (intern -> memc , MEMCACHED_HASH_DEFAULT );
2882
+ (void )memcached_behavior_set_distribution (intern -> memc , MEMCACHED_DISTRIBUTION_MODULA );
2919
2883
}
2920
2884
break ;
2921
2885
@@ -3997,10 +3961,10 @@ static zend_function_entry memcached_class_methods[] = {
3997
3961
3998
3962
MEMC_ME (set , arginfo_set )
3999
3963
MEMC_ME (setByKey , arginfo_setByKey )
4000
- #ifdef HAVE_MEMCACHED_TOUCH
3964
+
4001
3965
MEMC_ME (touch , arginfo_touch )
4002
3966
MEMC_ME (touchByKey , arginfo_touchByKey )
4003
- #endif
3967
+
4004
3968
MEMC_ME (setMulti , arginfo_setMulti )
4005
3969
MEMC_ME (setMultiByKey , arginfo_setMultiByKey )
4006
3970
@@ -4032,11 +3996,10 @@ static zend_function_entry memcached_class_methods[] = {
4032
3996
MEMC_ME (quit , arginfo_quit )
4033
3997
MEMC_ME (flushBuffers , arginfo_flushBuffers )
4034
3998
4035
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
4036
3999
MEMC_ME (getLastErrorMessage , arginfo_getLastErrorMessage )
4037
4000
MEMC_ME (getLastErrorCode , arginfo_getLastErrorCode )
4038
4001
MEMC_ME (getLastErrorErrno , arginfo_getLastErrorErrno )
4039
- #endif
4002
+
4040
4003
MEMC_ME (getLastDisconnectedServer , arginfo_getLastDisconnectedServer )
4041
4004
4042
4005
MEMC_ME (getStats , arginfo_getStats )
@@ -4229,9 +4192,8 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
4229
4192
REGISTER_MEMC_CLASS_CONST_LONG (OPT_DISTRIBUTION , MEMCACHED_BEHAVIOR_DISTRIBUTION );
4230
4193
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_MODULA , MEMCACHED_DISTRIBUTION_MODULA );
4231
4194
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_CONSISTENT , MEMCACHED_DISTRIBUTION_CONSISTENT );
4232
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00049000
4233
4195
REGISTER_MEMC_CLASS_CONST_LONG (DISTRIBUTION_VIRTUAL_BUCKET , MEMCACHED_DISTRIBUTION_VIRTUAL_BUCKET );
4234
- #endif
4196
+
4235
4197
REGISTER_MEMC_CLASS_CONST_LONG (OPT_LIBKETAMA_COMPATIBLE , MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED );
4236
4198
REGISTER_MEMC_CLASS_CONST_LONG (OPT_LIBKETAMA_HASH , MEMCACHED_BEHAVIOR_KETAMA_HASH );
4237
4199
REGISTER_MEMC_CLASS_CONST_LONG (OPT_TCP_KEEPALIVE , MEMCACHED_BEHAVIOR_TCP_KEEPALIVE );
@@ -4257,14 +4219,10 @@ static void php_memc_register_constants(INIT_FUNC_ARGS)
4257
4219
REGISTER_MEMC_CLASS_CONST_LONG (OPT_SORT_HOSTS , MEMCACHED_BEHAVIOR_SORT_HOSTS );
4258
4220
REGISTER_MEMC_CLASS_CONST_LONG (OPT_VERIFY_KEY , MEMCACHED_BEHAVIOR_VERIFY_KEY );
4259
4221
REGISTER_MEMC_CLASS_CONST_LONG (OPT_USE_UDP , MEMCACHED_BEHAVIOR_USE_UDP );
4260
- #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x00037000
4261
4222
REGISTER_MEMC_CLASS_CONST_LONG (OPT_NUMBER_OF_REPLICAS , MEMCACHED_BEHAVIOR_NUMBER_OF_REPLICAS );
4262
4223
REGISTER_MEMC_CLASS_CONST_LONG (OPT_RANDOMIZE_REPLICA_READ , MEMCACHED_BEHAVIOR_RANDOMIZE_REPLICA_READ );
4263
- #endif
4264
- #ifdef HAVE_MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS
4265
4224
REGISTER_MEMC_CLASS_CONST_LONG (OPT_REMOVE_FAILED_SERVERS , MEMCACHED_BEHAVIOR_REMOVE_FAILED_SERVERS );
4266
- #endif
4267
- #ifdef HAVE_MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT
4225
+ #if defined(LIBMEMCACHED_VERSION_HEX ) && LIBMEMCACHED_VERSION_HEX >= 0x01000018
4268
4226
REGISTER_MEMC_CLASS_CONST_LONG (OPT_SERVER_TIMEOUT_LIMIT , MEMCACHED_BEHAVIOR_SERVER_TIMEOUT_LIMIT );
4269
4227
#endif
4270
4228
0 commit comments