forked from CloudCraftSMP/GovOfficeWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlhandler.js
More file actions
41 lines (28 loc) · 919 Bytes
/
sqlhandler.js
File metadata and controls
41 lines (28 loc) · 919 Bytes
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
const exp = {};
const config = require("./config.json");
const mysql = require("mysql");
const MysqlCache = require('mysql-cache');
const LRU = require('lru-cache')
/*var Memento = require('memento-mysql');
var memcachedConfig = "127.0.0.1:11211";
exp.con = new Memento({
mysql: config.database,
memcached: memcachedConfig
});*/
//Exp.con = mysql.createConnection(config.database);
//exp.con = mysql.createPool(config.database);
exp.con = new MysqlCache(config.database);
exp.con.connect(err => {
if (err) {
throw err // Catch any nasty errors!
}
console.log('W00t! i\'m connected!!')
// Lets run some queries now!
})
/*exp.con.on('acquire', function (connection) {
console.log('Connection %d acquired', connection.threadId);
});
exp.con.on('release', function (connection) {
console.log('Connection %d released', connection.threadId);
});*/
module.exports = exp;