나는 세션 데이터에서 Memcache의 1메가바이트 장벽보다 클 때 전에이 문제를 했어. Memcache에 저장되기 전에 세션 데이터를 압축하여 해결했습니다.
<?php
class SessionHandler {
public $lifeTime;
public function __construct() {
$this->lifeTime = intval(ini_get("session.gc_maxlifetime"));
session_set_cookie_params(0,"/",".domain.com",false,true);
session_name("SITESESSION");
session_set_save_handler(array (&$this,"open"),array (&$this,"close"),array (&$this,"read"),array (&$this,"write"),array (&$this,"destroy"),array (&$this,"gc"));
session_start();
}
public function open($savePath,$sessionName) {
return true;
}
public function close() {
return true;
}
public function read($sessionID) {
# The default miss for MC is (bool) false, so return it
return MC::get("userSession_{$sessionID}");
}
public function write($sessionID,$data) {
# This is called upon script termination or when session_write_close() is called, which ever is first.
return MC::set("userSession_{$sessionID}",$data,$this->lifeTime,true); # The last true sets it as compressed.
}
public function destroy($sessionID) {
# Called when a user logs out...
return MC::delete("userSession_{$sessionID}");
}
public function gc($maxlifetime) {
# The MC keys expire on their own, no need to do anything here.
return true;
}
}
?>
안녕하세요 PureForm :
여기 내가 사용하는 코드입니다. 불행히도, 세션 데이터가 매우 작기 때문에 그건 내 경우가 아닙니다. – Thomas