Beispiel #1
0
	/**
	 * driver initialisation
	 *
	 * @access	public
	 * @return	void
	 */
	public function init()
	{
		// generic driver initialisation
		parent::init();

		if ($this->memcached === false)
		{
			// do we have the PHP memcached extension available
			if ( ! class_exists('Memcached') )
			{
				throw new \Fuel_Exception('Memcached sessions are configured, but your PHP installation doesn\'t have the Memcached extension loaded.');
			}

			// instantiate the memcached object
			$this->memcached = new \Memcached();

			// add the configured servers
			$this->memcached->addServers($this->config['servers']);

			// check if we can connect to the server(s)
			if ($this->memcached->getVersion() === false)
			{
				throw new \Fuel_Exception('Memcached sessions are configured, but there is no connection possible. Check your configuration.');
			}
		}
	}
Beispiel #2
0
 /**
  * driver initialisation
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     // generic driver initialisation
     parent::init();
     if ($this->redis === false) {
         // get the redis database instance
         $this->redis = \Redis::instance($this->config['database']);
     }
 }
 /**
  * driver initialisation
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     // generic driver initialisation
     parent::init();
     if ($this->memcached === false) {
         // do we have the PHP memcached extension available
         if (!class_exists('Memcached')) {
             throw new \FuelException('Memcached sessions are configured, but your PHP installation doesn\'t have the Memcached extension loaded.');
         }
         // instantiate the memcached object
         $this->memcached = new \Memcached();
         // add the configured servers
         $this->memcached->addServers($this->config['servers']);
         // check if we can connect to all the server(s)
         $added = $this->memcached->getStats();
         foreach ($this->config['servers'] as $server) {
             $server = $server['host'] . ':' . $server['port'];
             if (!isset($added[$server]) or $added[$server]['pid'] == -1) {
                 throw new \FuelException('Memcached sessions are configured, but there is no connection possible. Check your configuration.');
             }
         }
     }
 }