foreach ($this->handlers as $handler) {
            if ($handler->write($session_id, $session_data)) {
                return;
            }
        }
    }
    public function destroy($session_id)
    {
        foreach ($this->handlers as $handler) {
            $handler->destroy($session_id);
        }
    }
    public function gc($maxlifetime)
    {
        foreach ($this->handlers as $handler) {
            $handler->gc();
        }
    }
}
register_sessionhandler(Injector::inst()->get('HybridSessionStore'));
class HybridSessionStore_RequestFilter implements RequestFilter
{
    public function preRequest(SS_HTTPRequest $request, Session $session, DataModel $model)
    {
        // NOP
    }
    public function postRequest(SS_HTTPRequest $request, SS_HTTPResponse $response, DataModel $model)
    {
        session_write_close();
    }
}
 /**
  * Register the session handler as the default
  *
  * @param string $key Desired session key
  */
 public static function init($key = null)
 {
     $instance = Injector::inst()->get(__CLASS__);
     if (empty($key)) {
         user_error('HybridSessionStore::init() was not given a $key. Disabling cookie-based storage', E_USER_WARNING);
     } else {
         $instance->setKey($key);
     }
     register_sessionhandler($instance);
     self::$enabled = true;
 }