/** * @param array $options */ public function __construct(array $options = []) { //过期时间 if (isset($options["lifetime"])) { $this->_lifetime = $options["lifetime"]; } $parameters = $options["parameters"]; $options = $options["options"]; $this->_redis = new \Predis\Client($parameters, $options); session_set_save_handler([$this, "open"], [$this, "close"], [$this, "read"], [$this, "write"], [$this, "destroy"], [$this, "gc"]); parent::__construct($options); }
/** * @param array $options */ public function __construct(array $options = []) { //过期时间 if (isset($options["lifetime"])) { $this->_lifetime = $options["lifetime"]; } $default = ["hash_secret" => null, "hash_len" => 128, "hash_algo" => "sha512", "path" => "/", "httpOnly" => true]; $options = array_merge($default, $options); $this->_storage = new CookieStorage($options); session_set_save_handler([$this, "open"], [$this, "close"], [$this, "read"], [$this, "write"], [$this, "destroy"], [$this, "gc"]); parent::__construct($options); }
/** * @param array $options */ public function __construct(array $options = []) { $memcached = new \Memcached($options["persistent_id"]); $memcached->addServers($options["servers"]); //过期时间 if (isset($options["lifetime"])) { $this->_lifetime = $options["lifetime"]; } $options = [Memcached::OPT_LIBKETAMA_COMPATIBLE => true, Memcached::OPT_COMPRESSION => true]; $options = array_merge($options, (array) $options["options"]); $memcached->setOptions($options); $this->_mem = $memcached; session_set_save_handler([$this, "open"], [$this, "close"], [$this, "read"], [$this, "write"], [$this, "destroy"], [$this, "gc"]); parent::__construct($options); }