Example #1
0
 /**
  * @param array $injectors
  */
 public function __construct(array $injectors = array())
 {
     parent::__construct($injectors);
     if (!$this->injectors['client']) {
         $this->injectors['client'] = new \MongoClient($this->injectors['dsn'], $this->injectors['options']);
     }
     // Set client and collection
     $this->client = $this->injectors['client'];
     $this->collection = $this->client->selectCollection($this->injectors['database'], $this->injectors['collection']);
 }
Example #2
0
 /**
  * @param array $injectors
  */
 public function __construct(array $injectors = array())
 {
     parent::__construct($injectors);
     if (!$this->injectors['client']) {
         $this->injectors['client'] = new \Redis();
         $this->injectors['client']->connect($this->injectors['host'], $this->injectors['port']);
         $this->injectors['client']->select($this->injectors['db']);
     }
     // Save client
     $this->client = $this->injectors['client'];
 }