Example #1
0
 function __construct($db_config, $installation_data = NULL)
 {
     parent::__construct($db_config, $installation_data);
     try {
         $redis_port = property_exists($db_config, 'port') ? $db_config->port : 6379;
         $redis_timeout = property_exists($db_config, 'timeout') ? $db_config->timeout : 0;
         $this->_connection = new Redis();
         $this->_connection->connect($db_config->host, $redis_port, $redis_timeout);
         if (property_exists($db_config, 'prefix')) {
             // use custom prefix on all keys
             $this->_connection->setOption(Redis::OPT_PREFIX, $db_config->prefix);
         }
     } catch (RedisException $e) {
         $this->_raise_error($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
     }
 }
Example #2
0
 function __construct($db_config, $installation_data = NULL)
 {
     parent::__construct($db_config, $installation_data);
     try {
         $this->_connection = new Mongo('mongodb://' . $db_config->host);
         $this->_db_name = $db_config->db;
         $this->_db = $this->_connection->{$this->_db_name};
         $this->_collections = array($this->_db_name => array());
         if (property_exists($db_config, 'user')) {
             $this->_db->authenticate($db_config->user, $db_config->pass);
         }
     } catch (MongoException $e) {
         $this->_raise_error($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine());
         return;
     }
     $core =& Vevui::get();
     $this->_in_debug = $core->e->app->debug;
 }