/**
  * Constructor.
  *
  * @param string                $savePath   Path of memcache server.
  * @param array                 $options    Session configuration options.
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct($savePath = 'tcp://127.0.0.1:11211?persistent=0', array $options = array())
 {
     if (!extension_loaded('memcache')) {
         throw new \RuntimeException('PHP does not have "memcache" session module registered');
     }
     $this->savePath = $savePath;
     parent::__construct($options);
 }
 /**
  * Constructor.
  *
  * @param string                $dbPath     Path to SQLite database file.
  * @param array                 $options    Session configuration options.
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct($dbPath, array $options = array())
 {
     if (!extension_loaded('sqlite')) {
         throw new \RuntimeException('PHP does not have "sqlite" session module registered');
     }
     $this->dbPath = $dbPath;
     parent::__construct($options);
 }
Ejemplo n.º 3
0
 /**
  * Constructor.
  *
  *
  * @param \PDO                  $pdo        A \PDO instance
  * @param array                 $dbOptions  An associative array of DB options
  * @param array                 $options    Session configuration options
  *
  * @throws \InvalidArgumentException When "db_table" option is not provided
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct(\PDO $pdo, array $dbOptions = array(), array $options = array())
 {
     if (!array_key_exists('db_table', $dbOptions)) {
         throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.');
     }
     $this->pdo = $pdo;
     $this->dbOptions = array_merge(array('db_id_col' => 'sess_id', 'db_data_col' => 'sess_data', 'db_time_col' => 'sess_time'), $dbOptions);
     parent::__construct($options);
 }
Ejemplo n.º 4
0
 /**
  * Constructor.
  *
  * @param string                $savePath   Path of directory to save session files.
  * @param array                 $options    Session configuration options.
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct($savePath = null, array $options = array())
 {
     if (null === $savePath) {
         $savePath = sys_get_temp_dir();
     }
     if (!is_dir($savePath)) {
         mkdir($savePath, 0777, true);
     }
     $this->savePath = $savePath;
     parent::__construct($options);
 }
Ejemplo n.º 5
0
 /**
  * Constructor.
  *
  * @param \Memcached            $memcached        A \Memcached instance
  * @param array                 $memcachedOptions An associative array of Memcached options
  * @param array                 $options          Session configuration options.
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct(\Memcached $memcached, array $memcachedOptions = array(), array $options = array())
 {
     $this->memcached = $memcached;
     // defaults
     if (!isset($memcachedOptions['serverpool'])) {
         $memcachedOptions['serverpool'][] = array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 1);
     }
     $memcachedOptions['expiretime'] = isset($memcachedOptions['expiretime']) ? (int) $memcachedOptions['expiretime'] : 86400;
     $this->memcached->setOption(\Memcached::OPT_PREFIX_KEY, isset($memcachedOptions['prefix']) ? $memcachedOptions['prefix'] : 'sf2s');
     $this->memcachedOptions = $memcachedOptions;
     parent::__construct($options);
 }
Ejemplo n.º 6
0
 /**
  * Constructor.
  *
  * @param \Memcache             $memcache        A \Memcache instance
  * @param array                 $memcacheOptions An associative array of Memcachge options
  * @param array                 $options         Session configuration options.
  *
  * @see AbstractSessionStorage::__construct()
  */
 public function __construct(\Memcache $memcache, array $memcacheOptions = array(), array $options = array())
 {
     $this->memcache = $memcache;
     // defaults
     if (!isset($memcacheOptions['serverpool'])) {
         $memcacheOptions['serverpool'] = array(array('host' => '127.0.0.1', 'port' => 11211, 'timeout' => 1, 'persistent' => false, 'weight' => 1, 'retry_interval' => 15));
     }
     $memcacheOptions['expiretime'] = isset($memcacheOptions['expiretime']) ? (int) $memcacheOptions['expiretime'] : 86400;
     $this->prefix = isset($memcacheOptions['prefix']) ? $memcacheOptions['prefix'] : 'sf2s';
     $this->memcacheOptions = $memcacheOptions;
     parent::__construct($options);
 }