PHP中用memcache和memcahed存储session的差异

Eave 2014.12.18 13:04

以PHP session ID为key,用memcache类获取session数据时的区别

假设PHPSESSID=gb1rlrbgbcm637ednkrbn1sdh0

用memcache存储session时

GET gb1rlrbgbcm637ednkrbn1sdh0
session.save_handler = memcache
session.save_path = "tcp://127.0.0.1:11211"

用memcached存储session时

GET memc.sess.key.gb1rlrbgbcm637ednkrbn1sdh0

memc.sess.key这个前缀在php.ini中定义

session.save_handler = memcached
session.save_path = "127.0.0.1:11211"
memcached.sess_prefix = "memc.sess.key."