public function __construct(FrontendInterface $frontend, array $options)
{
if (!isset($options['hosts']) || !is_array($options['hosts'])) {
throw new Exception('No hosts given in options');
}
if (isset($options['namespace'])) {
$this->namespace = $options['namespace'];
unset($options['namespace']);
}
if (isset($options['prefix'])) {
$this->_prefix = $options['prefix'];
}
if (isset($options['set']) && !empty($options['set'])) {
$this->set = $options['set'];
unset($options['set']);
}
$persistent = false;
if (isset($options['persistent'])) {
$persistent = (bool) $options['persistent'];
}
$opts = [];
if (isset($options['options']) && is_array($options['options'])) {
$opts = $options['options'];
}
$this->db = new \Aerospike(['hosts' => $options['hosts']], $persistent, $opts);
if (!$this->db->isConnected()) {
throw new Exception(sprintf('Aerospike failed to connect [%s]: %s', $this->db->errorno(), $this->db->error()));
}
parent::__construct($frontend, $options);
}