這些函數的行為受 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 |
這是配置指令的簡(jiǎn)短說(shuō)明。
memcache.allow_failover
bool
是否在發(fā)生錯誤時(shí)(對用戶(hù))透明的轉移到其他服務(wù)器。
memcache.max_failover_attempts
int
定義在寫(xiě)入和獲取數據時(shí)最多嘗試的服務(wù)器次數(即:故障轉移最大嘗試數),僅和 memcache.allow_failover結合使用。
memcache.chunk_size
int
數據傳輸塊大小,這個(gè)值越小網(wǎng)絡(luò )I/O次數越多,如果發(fā)現莫名的速度降低, 可以嘗試將此值調至32768。
memcache.default_port
string
在嘗試連接memcache的時(shí)候如果沒(méi)有單獨指定端口默認使用的TCP端口號。
memcache.hash_strategy
string
控制key到服務(wù)器的映射(分布式)策略。值
consistent
允許服務(wù)器增減而不會(huì )(大量)導致健的重新映射
(譯注:參見(jiàn)http://tech.idv2.com/2008/07/24/memcached-004/),設置為
standard
則使用余數方式進(jìn)行key的映射。
memcache.hash_function
string
控制在key-server映射時(shí)使用哪個(gè)hash函數crc32
標明使用標準CRC32進(jìn)行hash,fnv
則說(shuō)明使用FNV-1a。
session.save_handler
string
當值為memcache
時(shí)標記使用memcache作為session處理器。
session.save_path
string
定義一個(gè)逗號分割的用于session存儲的服務(wù)器url列表,例如:
"tcp://host1:11211, tcp://host2:11211"
.
每個(gè)url可以包含參數,這些參數于方法Memcache::addServer()的參數相同。比如:
"tcp://host1:11211?persistent=1&weight=1&timeout=1&retry_interval=15"
memcache.protocol
string
memcache.redundancy
int
memcache.session_redundancy
int
memcache.compress_threshold
int
memcache.lock_timeout
int