namirasoft-node-redis 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RedisInstance.js +7 -0
- package/dist/RedisInstance.js.map +1 -1
- package/package.json +10 -7
- package/src/RedisInstance.ts +6 -0
- package/tsconfig.json +1 -1
package/dist/RedisInstance.js
CHANGED
|
@@ -34,10 +34,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.RedisInstance = void 0;
|
|
36
36
|
const Redis = __importStar(require("ioredis"));
|
|
37
|
+
const namirasoft_log_1 = require("namirasoft-log");
|
|
37
38
|
class RedisInstance {
|
|
38
39
|
constructor(host, port, password, db = 0) {
|
|
40
|
+
var _a;
|
|
39
41
|
if (!process.env.NAMIRASOFT_MUTE)
|
|
40
42
|
this.client = new Redis.Redis({ host, port, password, db });
|
|
43
|
+
(_a = namirasoft_log_1.Logger.main) === null || _a === void 0 ? void 0 : _a.info(`Redis was connected.`);
|
|
44
|
+
this.disconnect = this.disconnect.bind(this);
|
|
45
|
+
this._get = this._get.bind(this);
|
|
46
|
+
this._set = this._set.bind(this);
|
|
47
|
+
this._del = this._del.bind(this);
|
|
41
48
|
}
|
|
42
49
|
disconnect() {
|
|
43
50
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedisInstance.js","sourceRoot":"","sources":["../src/RedisInstance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;
|
|
1
|
+
{"version":3,"file":"RedisInstance.js","sourceRoot":"","sources":["../src/RedisInstance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,mDAAwC;AAExC,MAAsB,aAAa;IAG/B,YAAY,IAAY,EAAE,IAAY,EAAE,QAA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,CAAC,KAAK,CAAC,CAAC;YACjC,IAAI,MAAM;gBACN,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;KAAA;IACe,IAAI,CAAC,GAAW;;YAE5B,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe;gBAC3B,OAAO;YACX,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;KAAA;CACJ;AA7CD,sCA6CC;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,19 +3,22 @@
|
|
|
3
3
|
"title": "Namirasoft Node Redis",
|
|
4
4
|
"description": "Namira Software Corporation Node Redis NPM Package",
|
|
5
5
|
"icon": "logo.png",
|
|
6
|
-
"logo": "https://static.namirasoft.com/
|
|
6
|
+
"logo": "https://static.namirasoft.com/image/application/redis/logo/base.png",
|
|
7
7
|
"language": "ts",
|
|
8
8
|
"framework": "npm",
|
|
9
9
|
"application": "package",
|
|
10
10
|
"private": false,
|
|
11
|
-
"version": "1.3.
|
|
12
|
-
"main": "./dist/index.js",
|
|
13
|
-
"types": "./dist/index.d.ts",
|
|
11
|
+
"version": "1.3.2",
|
|
14
12
|
"author": "Amir Abolhasani",
|
|
15
13
|
"license": "MIT",
|
|
16
|
-
"
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": ""
|
|
18
|
+
},
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@types/node": "^20.
|
|
19
|
-
"ioredis": "^5.
|
|
20
|
+
"@types/node": "^20.12.7",
|
|
21
|
+
"ioredis": "^5.4.1",
|
|
22
|
+
"namirasoft-log": "^1.3.6"
|
|
20
23
|
}
|
|
21
24
|
}
|
package/src/RedisInstance.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Redis from "ioredis";
|
|
2
|
+
import { Logger } from "namirasoft-log";
|
|
2
3
|
|
|
3
4
|
export abstract class RedisInstance<V>
|
|
4
5
|
{
|
|
@@ -7,6 +8,11 @@ export abstract class RedisInstance<V>
|
|
|
7
8
|
{
|
|
8
9
|
if (!process.env.NAMIRASOFT_MUTE)
|
|
9
10
|
this.client = new Redis.Redis({ host, port, password, db });
|
|
11
|
+
Logger.main?.info(`Redis was connected.`);
|
|
12
|
+
this.disconnect = this.disconnect.bind(this);
|
|
13
|
+
this._get = this._get.bind(this);
|
|
14
|
+
this._set = this._set.bind(this);
|
|
15
|
+
this._del = this._del.bind(this);
|
|
10
16
|
}
|
|
11
17
|
disconnect()
|
|
12
18
|
{
|