CakeFest 2017 NYC, the Official CakePHP Conference

Configurația la rulare

Comportamentul acestor funcții este afectat de parametrii stabiliți în php.ini.

Memcached Opțiuni de configurare pentru
Denumire Valoare implicită Poate fi modificată Jurnal al modificărilor
memcached.sess_locking 1 PHP_INI_ALL
memcached.sess_consistent_hash 0 PHP_INI_ALL
memcached.sess_binary 0 PHP_INI_ALL
memcached.sess_lock_wait 150000 PHP_INI_ALL
memcached.sess_prefix memc.sess.key. PHP_INI_ALL
memcached.sess_number_of_replicas 0 PHP_INI_ALL
memcached.sess_randomize_replica_read 0 PHP_INI_ALL
memcached.sess_remove_failed 0 PHP_INI_ALL
memcached.compression_type fastlz PHP_INI_ALL
memcached.compression_factor 1.3 PHP_INI_ALL
memcached.compression_threshold 2000 PHP_INI_ALL
memcached.serializer php PHP_INI_ALL
memcached.use_sasl 0 PHP_INI_SYSTEM

Iată o explicație pe scurt a directivelor de configurare.

memcached.sess_locking integer

Use session locking. Valid values: On, Off, the default is On.

memcached.sess_consistent_hash integer

Memcached session consistent hash mode. If set to On, consistent hashing is used for session handling. When consistent hashing is used, one can add or remove cache node(s) without messing up too much with existing keys. The default is Off.

memcached.sess_binary integer

Use memcached session binary mode. Libmemcached replicas only work if binary mode is enabled. The default is Off.

memcached.sess_lock_wait integer

Session spin lock retry wait time in microseconds. Be carefull when setting this value. Valid values are integers, where 0 is interpreted as the default value. Negative values result in a reduces locking to a try lock. The default is 150000.

memcached.sess_prefix string

Memcached session key prefix. Valid values are strings less than 219 bytes long. The default value is "memc.sess.key."

memcached.sess_number_of_replicas integer

The memcached session number of replicas.

memcached.sess_randomize_replica_read integer

Memcached session replica read randomize.

memcached.sess_remove_failed integer

Allow failed memcached server to automatically be removed.

memcached.compression_type string

Set the compression type, valid values are: fastlz, zlib. The default is fastlz.

memcached.compression_factor float

Compression factor. Store compressed value only if the compression factor (saving) exceeds the set limit. Store compressed if: plain_len > comp_len * factor. The default value is 1.3 (23% space saving).

memcached.compression_threshold integer

The compression threshold. Do not compress serialized values below this threshold. The default is 2000 bytes.

memcached.serializer string

Set the default serializer for new memcached objects. Valid values are: php, igbinary, json, json_array.


Standard php JSON encoding. This serializer is fast and compact but only works on UTF-8 encoded data and does not fully implement serializing. See the JSON extension.


As json, but decodes into arrays.


The standard PHP serializer.


A binary serializer

The default is igbinary if available and php otherwise.

memcached.use_sasl integer

Use SASL authentication for connections. Valid values: On, Off. The default is Off.

add a note add a note

User Contributed Notes 2 notes

2 years ago
In case, you are wondering why your sessions are "killed" after 1440 seconds, take a look at session.gc_maxlifetime. It's value is used in memcached expiration field according to memcache protocol rules. Also, do not forget about cookie expiration time
adolfoabegg at gmail dot com
5 years ago
you can get the list of the possible options for the memcached.ini configuration file here:
To Top