Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
N
nestjs-redis
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
王智锐 (C)
nestjs-redis
Commits
0b1f99ac
Unverified
提交
0b1f99ac
authored
7月 25, 2021
作者:
Gyanendro Kh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #82 Nest 8 bug.
上级
0715fe68
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
13 行增加
和
15 行删除
+13
-15
redis-core.module.d.ts
dist/redis-core.module.d.ts
+3
-3
redis-core.module.js
dist/redis-core.module.js
+6
-7
redis-core.module.ts
lib/redis-core.module.ts
+4
-5
没有找到文件。
dist/redis-core.module.d.ts
浏览文件 @
0b1f99ac
import
{
DynamicModule
,
OnModuleDestroy
}
from
'@nestjs/common'
;
import
{
DynamicModule
,
OnModuleDestroy
}
from
'@nestjs/common'
;
import
{
ModuleRef
}
from
'@nestjs/core'
;
import
{
RedisModuleAsyncOptions
,
RedisModuleOptions
}
from
'./redis.interface'
;
import
{
RedisModuleAsyncOptions
,
RedisModuleOptions
}
from
'./redis.interface'
;
import
{
RedisClient
}
from
'./redis-client.provider'
;
export
declare
class
RedisCoreModule
implements
OnModuleDestroy
{
export
declare
class
RedisCoreModule
implements
OnModuleDestroy
{
private
readonly
options
;
private
readonly
options
;
private
readonly
moduleRef
;
private
readonly
redisClient
;
constructor
(
options
:
RedisModuleOptions
|
RedisModuleOptions
[],
moduleRef
:
ModuleRef
);
constructor
(
options
:
RedisModuleOptions
|
RedisModuleOptions
[],
redisClient
:
RedisClient
);
static
register
(
options
:
RedisModuleOptions
|
RedisModuleOptions
[]):
DynamicModule
;
static
register
(
options
:
RedisModuleOptions
|
RedisModuleOptions
[]):
DynamicModule
;
static
forRootAsync
(
options
:
RedisModuleAsyncOptions
):
DynamicModule
;
static
forRootAsync
(
options
:
RedisModuleAsyncOptions
):
DynamicModule
;
onModuleDestroy
():
void
;
onModuleDestroy
():
void
;
...
...
dist/redis-core.module.js
浏览文件 @
0b1f99ac
...
@@ -15,14 +15,13 @@ var RedisCoreModule_1;
...
@@ -15,14 +15,13 @@ var RedisCoreModule_1;
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
Object
.
defineProperty
(
exports
,
"__esModule"
,
{
value
:
true
});
exports
.
RedisCoreModule
=
void
0
;
exports
.
RedisCoreModule
=
void
0
;
const
common_1
=
require
(
"@nestjs/common"
);
const
common_1
=
require
(
"@nestjs/common"
);
const
core_1
=
require
(
"@nestjs/core"
);
const
redis_client_provider_1
=
require
(
"./redis-client.provider"
);
const
redis_client_provider_1
=
require
(
"./redis-client.provider"
);
const
redis_constants_1
=
require
(
"./redis.constants"
);
const
redis_constants_1
=
require
(
"./redis.constants"
);
const
redis_service_1
=
require
(
"./redis.service"
);
const
redis_service_1
=
require
(
"./redis.service"
);
let
RedisCoreModule
=
RedisCoreModule_1
=
class
RedisCoreModule
{
let
RedisCoreModule
=
RedisCoreModule_1
=
class
RedisCoreModule
{
constructor
(
options
,
moduleRef
)
{
constructor
(
options
,
redisClient
)
{
this
.
options
=
options
;
this
.
options
=
options
;
this
.
moduleRef
=
moduleRef
;
this
.
redisClient
=
redisClient
;
}
}
static
register
(
options
)
{
static
register
(
options
)
{
return
{
return
{
...
@@ -43,15 +42,14 @@ let RedisCoreModule = RedisCoreModule_1 = class RedisCoreModule {
...
@@ -43,15 +42,14 @@ let RedisCoreModule = RedisCoreModule_1 = class RedisCoreModule {
};
};
}
}
onModuleDestroy
()
{
onModuleDestroy
()
{
const
closeConnection
=
({
clients
,
defaultKey
})
=>
options
=>
{
const
closeConnection
=
({
clients
,
defaultKey
})
=>
(
options
)
=>
{
const
name
=
options
.
name
||
defaultKey
;
const
name
=
options
.
name
||
defaultKey
;
const
client
=
clients
.
get
(
name
);
const
client
=
clients
.
get
(
name
);
if
(
client
&&
!
options
.
keepAlive
)
{
if
(
client
&&
!
options
.
keepAlive
)
{
client
.
disconnect
();
client
.
disconnect
();
}
}
};
};
const
redisClient
=
this
.
moduleRef
.
get
(
redis_constants_1
.
REDIS_CLIENT
);
const
closeClientConnection
=
closeConnection
(
this
.
redisClient
);
const
closeClientConnection
=
closeConnection
(
redisClient
);
if
(
Array
.
isArray
(
this
.
options
))
{
if
(
Array
.
isArray
(
this
.
options
))
{
this
.
options
.
forEach
(
closeClientConnection
);
this
.
options
.
forEach
(
closeClientConnection
);
}
}
...
@@ -67,6 +65,7 @@ RedisCoreModule = RedisCoreModule_1 = __decorate([
...
@@ -67,6 +65,7 @@ RedisCoreModule = RedisCoreModule_1 = __decorate([
exports
:
[
redis_service_1
.
RedisService
],
exports
:
[
redis_service_1
.
RedisService
],
}),
}),
__param
(
0
,
common_1
.
Inject
(
redis_constants_1
.
REDIS_MODULE_OPTIONS
)),
__param
(
0
,
common_1
.
Inject
(
redis_constants_1
.
REDIS_MODULE_OPTIONS
)),
__metadata
(
"design:paramtypes"
,
[
Object
,
core_1
.
ModuleRef
])
__param
(
1
,
common_1
.
Inject
(
redis_constants_1
.
REDIS_CLIENT
)),
__metadata
(
"design:paramtypes"
,
[
Object
,
Object
])
],
RedisCoreModule
);
],
RedisCoreModule
);
exports
.
RedisCoreModule
=
RedisCoreModule
;
exports
.
RedisCoreModule
=
RedisCoreModule
;
lib/redis-core.module.ts
浏览文件 @
0b1f99ac
...
@@ -5,7 +5,6 @@ import {
...
@@ -5,7 +5,6 @@ import {
Inject
,
Inject
,
OnModuleDestroy
,
OnModuleDestroy
,
}
from
'@nestjs/common'
;
}
from
'@nestjs/common'
;
import
{
ModuleRef
}
from
'@nestjs/core'
;
import
{
RedisModuleAsyncOptions
,
RedisModuleOptions
}
from
'./redis.interface'
;
import
{
RedisModuleAsyncOptions
,
RedisModuleOptions
}
from
'./redis.interface'
;
import
{
import
{
createAsyncClientOptions
,
createAsyncClientOptions
,
...
@@ -25,7 +24,8 @@ export class RedisCoreModule implements OnModuleDestroy {
...
@@ -25,7 +24,8 @@ export class RedisCoreModule implements OnModuleDestroy {
constructor
(
constructor
(
@
Inject
(
REDIS_MODULE_OPTIONS
)
@
Inject
(
REDIS_MODULE_OPTIONS
)
private
readonly
options
:
RedisModuleOptions
|
RedisModuleOptions
[],
private
readonly
options
:
RedisModuleOptions
|
RedisModuleOptions
[],
private
readonly
moduleRef
:
ModuleRef
,
@
Inject
(
REDIS_CLIENT
)
private
readonly
redisClient
:
RedisClient
,
)
{}
)
{}
static
register
(
static
register
(
...
@@ -51,7 +51,7 @@ export class RedisCoreModule implements OnModuleDestroy {
...
@@ -51,7 +51,7 @@ export class RedisCoreModule implements OnModuleDestroy {
}
}
onModuleDestroy
()
{
onModuleDestroy
()
{
const
closeConnection
=
({
clients
,
defaultKey
})
=>
options
=>
{
const
closeConnection
=
({
clients
,
defaultKey
})
=>
(
options
)
=>
{
const
name
=
options
.
name
||
defaultKey
;
const
name
=
options
.
name
||
defaultKey
;
const
client
=
clients
.
get
(
name
);
const
client
=
clients
.
get
(
name
);
...
@@ -60,8 +60,7 @@ export class RedisCoreModule implements OnModuleDestroy {
...
@@ -60,8 +60,7 @@ export class RedisCoreModule implements OnModuleDestroy {
}
}
};
};
const
redisClient
=
this
.
moduleRef
.
get
<
RedisClient
>
(
REDIS_CLIENT
);
const
closeClientConnection
=
closeConnection
(
this
.
redisClient
);
const
closeClientConnection
=
closeConnection
(
redisClient
);
if
(
Array
.
isArray
(
this
.
options
))
{
if
(
Array
.
isArray
(
this
.
options
))
{
this
.
options
.
forEach
(
closeClientConnection
);
this
.
options
.
forEach
(
closeClientConnection
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论