-
Notifications
You must be signed in to change notification settings - Fork 5
/
Welcome.php
42 lines (31 loc) · 1.51 KB
/
Welcome.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index() {
require_once APPPATH . 'libraries/codeigniter-predis/src/Redis.php';
echo '<pre>';
echo 'See application/config/codeigniter-predis.php file <br><br>';
// Using the default_server configuration
$this->redis = new \CI_Predis\Redis();
echo 'PING server setted to default_server config param: ';
echo $this->redis->ping() . '<br><br>';
echo 'PING server setted to default_server config param, another way: ';
echo $this->redis->getServerConnected()->ping() . '<br><br>';
// Specifying hosts
$this->redis = new \CI_Predis\Redis(['serverName' => 'localhost']);
// Ping the localhost server
echo 'PING localhost server: ';
echo $this->redis->ping() . '<br><br>';
echo 'PING localhost server again, another way: ';
echo $this->redis->getServerConnected()->ping() . '<br><br>';
// Connect to another server
$this->redis->connect('another_instance_example');
echo 'PING server another_instance_example: ';
echo $this->redis->ping() . '<br><br>';
echo 'PING server another_instance_example again: ';
echo $this->redis->getServersCollection()->getServer('another_instance_example')->ping() . '<br><br>';
// Calling a command in a not connected server
//echo 'PING a not connected server: <br>';
// $this->redis->getServersCollection()->getServer('not_connected_server')->ping() . '<br>';
}
}