運(yùn)行時(shí)配置

這些函數(shù)的行為受 php.ini 中的設(shè)置影響。

Memcache配置選項(xiàng)
名字 默認(rèn) 可修改范圍 更新日志
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
有關(guān) PHP_INI_* 樣式的更多詳情與定義,見 配置可被設(shè)定范圍。

這是配置指令的簡短說明。

memcache.allow_failover bool

是否在發(fā)生錯(cuò)誤時(shí)(對用戶)透明的轉(zhuǎn)移到其他服務(wù)器。

memcache.max_failover_attempts int

定義在寫入和獲取數(shù)據(jù)時(shí)最多嘗試的服務(wù)器次數(shù)(即:故障轉(zhuǎn)移最大嘗試數(shù)),僅和 memcache.allow_failover結(jié)合使用。

memcache.chunk_size int

數(shù)據(jù)傳輸塊大小,這個(gè)值越小網(wǎng)絡(luò)I/O次數(shù)越多,如果發(fā)現(xiàn)莫名的速度降低, 可以嘗試將此值調(diào)至32768。

memcache.default_port string

在嘗試連接memcache的時(shí)候如果沒有單獨(dú)指定端口默認(rèn)使用的TCP端口號。

memcache.hash_strategy string

控制key到服務(wù)器的映射(分布式)策略。值 consistent允許服務(wù)器增減而不會(大量)導(dǎo)致健的重新映射 (譯注:參見http://tech.idv2.com/2008/07/24/memcached-004/),設(shè)置為 standard則使用余數(shù)方式進(jìn)行key的映射。

memcache.hash_function string

控制在key-server映射時(shí)使用哪個(gè)hash函數(shù)crc32 標(biāo)明使用標(biāo)準(zhǔn)CRC32進(jìn)行hash,fnv則說明使用FNV-1a。

session.save_handler string

當(dāng)值為memcache時(shí)標(biāo)記使用memcache作為session處理器。

session.save_path string

定義一個(gè)逗號分割的用于session存儲的服務(wù)器url列表,例如: "tcp://host1:11211, tcp://host2:11211".

每個(gè)url可以包含參數(shù),這些參數(shù)于方法Memcache::addServer()的參數(shù)相同。比如: "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