@midwayjs/redis 3.2.0 → 3.3.0
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/manager.d.ts +5 -5
- package/dist/manager.js +5 -5
- package/index.d.ts +1 -1
- package/package.json +5 -6
package/dist/manager.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ServiceFactory } from '@midwayjs/core';
|
|
2
|
-
import
|
|
3
|
-
export declare class RedisServiceFactory extends ServiceFactory<Redis
|
|
2
|
+
import Redis from 'ioredis';
|
|
3
|
+
export declare class RedisServiceFactory extends ServiceFactory<Redis> {
|
|
4
4
|
redisConfig: any;
|
|
5
5
|
init(): Promise<void>;
|
|
6
6
|
logger: any;
|
|
7
|
-
createClient(config: any): Promise<Redis
|
|
7
|
+
createClient(config: any): Promise<Redis>;
|
|
8
8
|
getName(): string;
|
|
9
9
|
destroyClient(redisInstance: any): Promise<void>;
|
|
10
10
|
}
|
|
11
|
-
export declare class RedisService implements Redis
|
|
11
|
+
export declare class RedisService implements Redis {
|
|
12
12
|
private serviceFactory;
|
|
13
13
|
private instance;
|
|
14
14
|
init(): Promise<void>;
|
|
15
15
|
}
|
|
16
|
-
export interface RedisService extends Redis
|
|
16
|
+
export interface RedisService extends Redis {
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=manager.d.ts.map
|
package/dist/manager.js
CHANGED
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.RedisService = exports.RedisServiceFactory = void 0;
|
|
13
13
|
const decorator_1 = require("@midwayjs/decorator");
|
|
14
14
|
const core_1 = require("@midwayjs/core");
|
|
15
|
-
const
|
|
15
|
+
const ioredis_1 = require("ioredis");
|
|
16
16
|
const assert = require("assert");
|
|
17
17
|
let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactory {
|
|
18
18
|
async init() {
|
|
@@ -28,7 +28,7 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
|
|
|
28
28
|
`[midway:redis] 'host: ${client.host}', 'port: ${client.port}' are required on config`);
|
|
29
29
|
});
|
|
30
30
|
this.logger.info('[midway:redis] cluster connecting');
|
|
31
|
-
client = new
|
|
31
|
+
client = new ioredis_1.default.Cluster(config.nodes, config);
|
|
32
32
|
}
|
|
33
33
|
else if (config.sentinels) {
|
|
34
34
|
assert(config.sentinels && config.sentinels.length !== 0, '[midway:redis] sentinels configuration is required when use redis sentinel');
|
|
@@ -36,12 +36,12 @@ let RedisServiceFactory = class RedisServiceFactory extends core_1.ServiceFactor
|
|
|
36
36
|
assert(sentinel.host && sentinel.port, `[midway:redis] 'host: ${sentinel.host}', 'port: ${sentinel.port}' are required on config`);
|
|
37
37
|
});
|
|
38
38
|
this.logger.info('[midway:redis] sentinel connecting start');
|
|
39
|
-
client = new
|
|
39
|
+
client = new ioredis_1.default(config);
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
42
|
assert(config.host && config.port, `[midway:redis] 'host: ${config.host}', 'port: ${config.port}' are required on config`);
|
|
43
43
|
this.logger.info('[midway:redis] server connecting redis://:***@%s:%s/%s', config.host, config.port);
|
|
44
|
-
client = new
|
|
44
|
+
client = new ioredis_1.default(config);
|
|
45
45
|
}
|
|
46
46
|
client.on('connect', () => {
|
|
47
47
|
this.logger.info('[midway:redis] client connect success');
|
|
@@ -103,5 +103,5 @@ RedisService = __decorate([
|
|
|
103
103
|
(0, decorator_1.Scope)(decorator_1.ScopeEnum.Singleton)
|
|
104
104
|
], RedisService);
|
|
105
105
|
exports.RedisService = RedisService;
|
|
106
|
-
(0, core_1.
|
|
106
|
+
(0, core_1.delegateTargetAllPrototypeMethod)(RedisService, ioredis_1.default);
|
|
107
107
|
//# sourceMappingURL=manager.js.map
|
package/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/redis",
|
|
3
3
|
"description": "midway redis component",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -10,13 +10,12 @@
|
|
|
10
10
|
"index.d.ts"
|
|
11
11
|
],
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"@midwayjs/core": "^3.
|
|
13
|
+
"@midwayjs/core": "^3.3.0",
|
|
14
14
|
"@midwayjs/decorator": "^3.1.6",
|
|
15
|
-
"@midwayjs/mock": "^3.
|
|
16
|
-
"@types/ioredis": "4.28.10"
|
|
15
|
+
"@midwayjs/mock": "^3.3.0"
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
|
-
"ioredis": "^
|
|
18
|
+
"ioredis": "^5.0.0"
|
|
20
19
|
},
|
|
21
20
|
"keywords": [
|
|
22
21
|
"redis"
|
|
@@ -37,5 +36,5 @@
|
|
|
37
36
|
"type": "git",
|
|
38
37
|
"url": "https://github.com/midwayjs/midway.git"
|
|
39
38
|
},
|
|
40
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "b12b41188879296f9863265baa5bbdb4158bddc5"
|
|
41
40
|
}
|