Skip to content

Commit bf16783

Browse files
authored
Merge pull request #330 from remicollet/issue-ini
Refresh memcached.ini and set sess_binary_protocol off by default with older libmemcached
2 parents 23cf6c6 + 0a90491 commit bf16783

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

Diff for: memcached.ini

+30-30
Original file line numberDiff line numberDiff line change
@@ -2,57 +2,55 @@
22
; Use session locking
33
; valid values: On, Off
44
; the default is On
5-
memcached.sess_locking = On
6-
7-
; !! DEPRECATED AND REMOVED in 3.x !!
8-
; memcached.sess_lock_wait = 150000
9-
10-
; !! DEPRECATED AND REMOVED in 3.x !!
11-
; memcached.sess_lock_max_wait = 0;
5+
;memcached.sess_locking = On
126

137
; The minimum time, in milliseconds, to wait between session lock attempts.
148
; This value is double on each lock retry until memcached.sess_lock_wait_max
159
; is reached, after which any further retries will take sess_lock_wait_max seconds.
1610
; Default is 1000.
17-
memcached.sess_lock_wait_min = 1000;
11+
;memcached.sess_lock_wait_min = 1000;
1812

1913
; The maximum time, in milliseconds, to wait between session lock attempts.
2014
; Default is 2000.
21-
memcached.sess_lock_wait_max = 2000;
15+
;memcached.sess_lock_wait_max = 2000;
2216

2317
; The number of times to retry locking the session lock, not including the first attempt.
2418
; Default is 5.
25-
memcached.sess_lock_retries = 5;
19+
;memcached.sess_lock_retries = 5;
2620

2721
; The time, in seconds, before a lock should release itself.
2822
; Setting to 0 results in the default behaviour, which is to
2923
; use the memcached.sess_lock_max_wait setting. If that is
3024
; also 0, max_execution_time will be used.
31-
memcached.sess_lock_expire = 0;
25+
;memcached.sess_lock_expire = 0;
3226

3327
; memcached session key prefix
3428
; valid values are strings less than 219 bytes long
3529
; the default value is "memc.sess.key."
36-
memcached.sess_prefix = "memc.sess.key."
30+
;memcached.sess_prefix = "memc.sess.key."
3731

3832
; Whether or not to re-use the memcached connections corresponding to the value(s)
3933
; of session.save_path after the execution of the script ends.
4034
; Don't use this if certain settings (e.g. SASL settings, sess_binary_protocol) would
4135
; be overridden between requests.
4236
; Default is Off.
43-
memcached.sess_persistent = Off
37+
;memcached.sess_persistent = Off
4438

4539
; memcached session consistent hash mode
4640
; if set to On, consistent hashing (libketama) is used
4741
; for session handling.
4842
; When consistent hashing is used, one can add or remove cache
4943
; node(s) without messing up too much with existing keys
5044
; default is On
51-
memcached.sess_consistent_hash = On
45+
;memcached.sess_consistent_hash = On
5246

5347
; Allow failed memcached server to automatically be removed.
5448
; Default is Off. (In previous versions, this setting was called memcached.sess_remove_failed)
55-
memcached.sess_remove_failed_servers = Off
49+
;memcached.sess_remove_failed_servers = Off
50+
51+
; Set this value to enable the server be removed after
52+
; configured number of continuous times connection failure.
53+
;memcached.sess_server_failure_limit = 0
5654

5755
; Write data to a number of additional memcached servers
5856
; This is "poor man's HA" as libmemcached calls it.
@@ -61,34 +59,36 @@ memcached.sess_remove_failed_servers = Off
6159
; from a replica. However, if the failed memcache server
6260
; becomes available again it will read the session from there
6361
; which could have old data or no data at all
64-
memcached.sess_number_of_replicas = 0
62+
;memcached.sess_number_of_replicas = 0
6563

6664
; Use the memcached binary protocol for memcached sessions (Instead of the text protocol)
6765
; libmemcached replicas work only if binary mode is enabled.
6866
; However, certain proxies (such as twemproxy) will work only if the binary protocol is disabled.
69-
; Default is On. In older versions of php-memcached, this setting was Off and was called memcached.sess_binary.
70-
memcached.sess_binary_protocol = On
67+
; In older versions of php-memcached, this setting was Off and was called memcached.sess_binary.
68+
; Default is On with libmemcached 1.0.18 or newer.
69+
; Default is Off with older version.
70+
;memcached.sess_binary_protocol = On
7171

7272
; memcached session replica read randomize
73-
memcached.sess_randomize_replica_read = Off
73+
;memcached.sess_randomize_replica_read = Off
7474

7575
; memcached connect timeout value
7676
; In non-blocking mode this changes the value of the timeout
7777
; during socket connection in milliseconds. Specifying -1 means an infinite timeout.
78-
memcached.sess_connect_timeout = 1000
78+
;memcached.sess_connect_timeout = 1000
7979

8080
; Session SASL username
8181
; Both username and password need to be set for SASL to be enabled
8282
; In addition to this memcached.use_sasl needs to be on
83-
memcached.sess_sasl_username = NULL
83+
;memcached.sess_sasl_username = NULL
8484

8585
; Session SASL password
86-
memcached.sess_sasl_password = NULL
86+
;memcached.sess_sasl_password = NULL
8787

8888
; Set the compression type
8989
; valid values are: fastlz, zlib
9090
; the default is fastlz
91-
memcached.compression_type = "fastlz"
91+
;memcached.compression_type = "fastlz"
9292

9393
; Compression factor
9494
; Store compressed value only if the compression
@@ -98,13 +98,13 @@ memcached.compression_type = "fastlz"
9898
; plain_len > comp_len * factor
9999
;
100100
; the default value is 1.3 (23% space saving)
101-
memcached.compression_factor = "1.3"
101+
;memcached.compression_factor = "1.3"
102102

103103
; The compression threshold
104104
;
105105
; Do not compress serialized values below this threshold.
106106
; the default is 2000 bytes
107-
memcached.compression_threshold = 2000
107+
;memcached.compression_threshold = 2000
108108

109109
; Set the default serializer for new memcached objects.
110110
; valid values are: php, igbinary, json, json_array, msgpack
@@ -119,14 +119,14 @@ memcached.compression_threshold = 2000
119119
; msgpack - a cross-language binary serializer
120120
;
121121
; The default is igbinary if available, then msgpack if available, then php otherwise.
122-
memcached.serializer = "igbinary"
122+
;memcached.serializer = "igbinary"
123123

124124
; The amount of retries for failed store commands.
125125
; This mechanism allows transparent fail-over to secondary servers when
126126
; set/increment/decrement/setMulti operations fail on the desired server in a multi-server
127127
; environment.
128128
; the default is 2
129-
memcached.store_retry_count = 2
129+
;memcached.store_retry_count = 2
130130

131131
; Sets the default for consistent hashing for new connections.
132132
; (To configure consistent hashing for session connections,
@@ -137,7 +137,7 @@ memcached.store_retry_count = 2
137137
; When consistent hashing is used, one can add or remove cache
138138
; node(s) without messing up too much with existing keys
139139
; default is Off
140-
memcached.default_consistent_hash = Off
140+
;memcached.default_consistent_hash = Off
141141

142142
; Sets the default memcached protocol for new connections.
143143
; (To configure the memcached protocol for connections used by sessions,
@@ -146,7 +146,7 @@ memcached.default_consistent_hash = Off
146146
; If set to On, the memcached binary protocol is used by default.
147147
; If set to Off, the memcached text protocol is used.
148148
; Default is Off
149-
memcached.default_binary_protocol = Off
149+
;memcached.default_binary_protocol = Off
150150

151151
; Sets the default memcached connection timeout for new connections.
152152
; (To configure the memcached connection timeout for sessions,
@@ -155,4 +155,4 @@ memcached.default_binary_protocol = Off
155155
; during socket connection in milliseconds. Specifying -1 means an infinite timeout.
156156
; Specifying 0 means using the memcached library's default connection timeout.
157157
; Default is 0.
158-
memcached.default_connect_timeout = 0
158+
;memcached.default_connect_timeout = 0

Diff for: php_memcached.c

+4
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,11 @@ PHP_INI_BEGIN()
333333
MEMC_SESSION_INI_ENTRY("lock_wait_max", "2000", OnUpdateLongGEZero, lock_wait_max)
334334
MEMC_SESSION_INI_ENTRY("lock_retries", "5", OnUpdateLong, lock_retries)
335335
MEMC_SESSION_INI_ENTRY("lock_expire", "0", OnUpdateLongGEZero, lock_expiration)
336+
#if defined(LIBMEMCACHED_VERSION_HEX) && LIBMEMCACHED_VERSION_HEX < 0x01000018
337+
MEMC_SESSION_INI_ENTRY("binary_protocol", "0", OnUpdateBool, binary_protocol_enabled)
338+
#else
336339
MEMC_SESSION_INI_ENTRY("binary_protocol", "1", OnUpdateBool, binary_protocol_enabled)
340+
#endif
337341
MEMC_SESSION_INI_ENTRY("consistent_hash", "1", OnUpdateBool, consistent_hash_enabled)
338342
MEMC_SESSION_INI_ENTRY("number_of_replicas", "0", OnUpdateLongGEZero, number_of_replicas)
339343
MEMC_SESSION_INI_ENTRY("randomize_replica_read", "0", OnUpdateLongGEZero, randomize_replica_read_enabled)

0 commit comments

Comments
 (0)