/** * {@inheritdoc} * * @param array $options Options array */ public function __construct(array $options = []) { if (!isset($options['host'])) { $options['host'] = '127.0.0.1'; } if (!isset($options['port'])) { $options['port'] = 6379; } if (!isset($options['persistent'])) { $options['persistent'] = false; } parent::__construct($options); $this->redis = new BackendRedis(new FrontendData(['lifetime' => $this->options['lifetime']]), $options); }
/** * {@inheritdoc} * * @param null|array $options options array * * @throws \Phalcon\Mvc\Model\Exception */ public function __construct($options = null) { if (!is_array($options)) { throw new Exception('No configuration given'); } if (!isset($options['host'])) { throw new Exception('No host given in options'); } if (!isset($options['port'])) { $options['port'] = self::$defaultPort; } if (!isset($options['weight'])) { $options['weight'] = self::$defaultWeight; } parent::__construct($options); }
/** * {@inheritdoc} * * @param array $options Options array * @throws Exception */ public function __construct(array $options = []) { if (!isset($options['hosts']) || !is_array($options['hosts']) || !isset($options['hosts'][0]) || !is_array($options['hosts'][0])) { throw new Exception('No hosts given in options'); } if (isset($options['namespace'])) { $this->namespace = $options['namespace']; } if (isset($options['set']) && !empty($options['set'])) { $this->set = $options['set']; } if (!isset($options['persistent'])) { $options['persistent'] = false; } if (!isset($options['options']) || !is_array($options['options'])) { $options['options'] = []; } parent::__construct($options); $this->aerospike = new BackendAerospike(new FrontendData(['lifetime' => $this->options['lifetime']]), ['hosts' => $this->options['hosts'], 'namespace' => $this->namespace, 'set' => $this->set, 'prefix' => $this->options['lifetime'], 'persistent' => (bool) $this->options['persistent'], 'options' => $this->options['options']]); }