-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnection.php
43 lines (35 loc) · 982 Bytes
/
connection.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
43
<?php
# connection.php
require_once "vendor/autoload.php";
class Mongo
{
private static $instance = NULL;
public static function getInstance(){
if(!isset(self::$instance)){
$client = new MongoDB\Client;("mongodb://localhost:27017");
self::$instance = $client;
}
return self::$instance;
}
}
class Redis{
private static $instance = NULL;
public static function getInstance(){
if(!isset(self::$instance)){
self::$instance = new Predis\Client();
}
return self::$instance;
}
}
class Neo4J{
private static $instance = NULL;
public static function getInstace(){
if(!isset(self::$instance)){
self::$instance =Neoxygen\NeoClient\ClientBuilder::create()
->addConnection('default', 'http', 'localhost', 7474)
->setAutoFormatResponse(true)
->build();
}
return self::$instance;
}
}