©
Ce document utilise Manuel du site Web PHP chinois Libérer
这些函数的行为受 php.ini 中的设置影响。
名字 | 默认 | 可修改范围 | 更新日志 |
---|---|---|---|
memcache.allow_failover | "1" | PHP_INI_ALL | Available since memcache 2.0.2. |
memcache.max_failover_attempts | "20" | PHP_INI_ALL | Available since memcache 2.1.0. |
memcache.chunk_size | "8192" | PHP_INI_ALL | Available since memcache 2.0.2. |
memcache.default_port | "11211" | PHP_INI_ALL | Available since memcache 2.0.2. |
memcache.hash_strategy | "standard" | PHP_INI_ALL | Available since memcache 2.2.0. |
memcache.hash_function | "crc32" | PHP_INI_ALL | Available since memcache 2.2.0. |
session.save_handler | "files" | PHP_INI_ALL | Supported since memcache 2.1.2 |
session.save_path | "" | PHP_INI_ALL | Supported since memcache 2.1.2 |
memcache.protocol | ascii | >PHP_INI_ALL | Supported since memcache 3.0.0 |
memcache.redundancy | 1 | >PHP_INI_ALL | Supported since memcache 3.0.0 |
memcache.session_redundancy | 2 | >PHP_INI_ALL | Supported since memcache 3.0.0 |
memcache.compress_threshold | 20000 | >PHP_INI_ALL | Supported since memcache 3.0.3 |
memcache.lock_timeout | 15 | >PHP_INI_ALL | Supported since memcache 3.0.4 |
这是配置指令的简短说明。
memcache.allow_failover
boolean 是否在发生错误时(对用户)透明的转移到其他服务器。
memcache.max_failover_attempts
integer 定义在写入和获取数据时最多尝试的服务器次数(即:故障转移最大尝试数),仅和 memcache.allow_failover结合使用。
memcache.chunk_size
integer 数据传输块大小,这个值越小网络I/O次数越多,如果发现莫名的速度降低, 可以尝试将此值调至32768。
memcache.default_port
string 在尝试连接memcache的时候如果没有单独指定端口默认使用的TCP端口号。
memcache.hash_strategy
string 控制key到服务器的映射(分布式)策略。值 consistent允许服务器增减而不会(大量)导致健的重新映射 (译注:参见http://tech.idv2.com/2008/07/24/memcached-004/),设置为 standard则使用余数方式进行key的映射。
memcache.hash_function
string 控制在key-server映射时使用哪个hash函数crc32 标明使用标准CRC32进行hash,fnv则说明使用FNV-1a。
session.save_handler
string 当值为memcache时标记使用memcache作为session处理器。
session.save_path
string 定义一个逗号分割的用于session存储的服务器url列表,例如: "tcp://host1:11211, tcp://host2:11211".
每个url可以包含参数,这些参数于方法 Memcache::addServer() 的参数相同。比如: "tcp://host1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
memcache.protocol
string
memcache.redundancy
integer
memcache.session_redundancy
integer
memcache.compress_threshold
integer
memcache.lock_timeout
integer
[#1] kross at escapistmag dot com [2010-03-22 09:06:56]
There's a currently undocumented variable that is now available (you can see it in php_info()) for session handling:
memcache.session_redundancy
The default seems to be "2", and it is supposed to influence how many copies of a particular session object that Memcache will store for failover purposes (so with a redundancy of 2, it will store a session on 2 different shards).
This will add slight overhead with extra writes, but overall seems worth it for purposes of failover.