Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
N
nestjs-redis
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
王智锐 (C)
nestjs-redis
Commits
5159143f
提交
5159143f
authored
12月 05, 2018
作者:
zzy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add readme.md
上级
ef3a7dd0
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
131 行增加
和
1 行删除
+131
-1
README.md
README.md
+131
-1
没有找到文件。
README.md
浏览文件 @
5159143f
# Nest Redis Module
\ No newline at end of file
<h1
align=
"center"
>
Nestjs Redis
</h1>
<p
align=
"center"
>
Redis component for NestJs.
</p>
### Installation
**Yarn**
```
bash
yarn add nestjs-redis
```
**NPM**
```
bash
npm
install
nestjs-redis
--save
```
### Getting Started
Let's register the config module in
`app.module.ts`
```
typescript
import
{
Module
}
from
'@nestjs/common'
;
import
{
RedisModule
}
from
'nestjs-redis'
@
Module
({
imports
:
[
RedisModule
.
register
(
options
)
],
})
export
class
AppModule
{}
```
Options
```
typescript
interface
RedisOptions
{
port
?:
number
;
host
?:
string
;
/**
* 4 (IPv4) or 6 (IPv6), Defaults to 4.
*/
family
?:
number
;
/**
* Local domain socket path. If set the port, host and family will be ignored.
*/
path
?:
string
;
/**
* TCP KeepAlive on the socket with a X ms delay before start. Set to a non-number value to disable keepAlive.
*/
keepAlive
?:
number
;
connectionName
?:
string
;
/**
* If set, client will send AUTH command with the value of this option when connected.
*/
password
?:
string
;
/**
* Database index to use.
*/
db
?:
number
;
/**
* When a connection is established to the Redis server, the server might still be loading
* the database from disk. While loading, the server not respond to any commands.
* To work around this, when this option is true, ioredis will check the status of the Redis server,
* and when the Redis server is able to process commands, a ready event will be emitted.
*/
enableReadyCheck
?:
boolean
;
keyPrefix
?:
string
;
/**
* When the return value isn't a number, ioredis will stop trying to reconnect.
* Fixed in: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/15858
*/
retryStrategy
?(
times
:
number
):
number
|
false
;
/**
* By default, all pending commands will be flushed with an error every
* 20 retry attempts. That makes sure commands won't wait forever when
* the connection is down. You can change this behavior by setting
* `maxRetriesPerRequest`.
*
* Set maxRetriesPerRequest to `null` to disable this behavior, and
* every command will wait forever until the connection is alive again
* (which is the default behavior before ioredis v4).
*/
maxRetriesPerRequest
?:
number
|
null
;
/**
* 1/true means reconnect, 2 means reconnect and resend failed command. Returning false will ignore
* the error and do nothing.
*/
reconnectOnError
?(
error
:
Error
):
boolean
|
1
|
2
;
/**
* By default, if there is no active connection to the Redis server, commands are added to a queue
* and are executed once the connection is "ready" (when enableReadyCheck is true, "ready" means
* the Redis server has loaded the database from disk, otherwise means the connection to the Redis
* server has been established). If this option is false, when execute the command when the connection
* isn't ready, an error will be returned.
*/
enableOfflineQueue
?:
boolean
;
/**
* The milliseconds before a timeout occurs during the initial connection to the Redis server.
* default: 10000.
*/
connectTimeout
?:
number
;
/**
* After reconnected, if the previous connection was in the subscriber mode, client will auto re-subscribe these channels.
* default: true.
*/
autoResubscribe
?:
boolean
;
/**
* If true, client will resend unfulfilled commands(e.g. block commands) in the previous connection when reconnected.
* default: true.
*/
autoResendUnfulfilledCommands
?:
boolean
;
lazyConnect
?:
boolean
;
tls
?:
tls
.
ConnectionOptions
;
sentinels
?:
Array
<
{
host
:
string
;
port
:
number
;
}
>
;
name
?:
string
;
/**
* Enable READONLY mode for the connection. Only available for cluster mode.
* default: false.
*/
readOnly
?:
boolean
;
/**
* If you are using the hiredis parser, it's highly recommended to enable this option.
* Create another instance with dropBufferSupport disabled for other commands that you want to return binary instead of string
*/
dropBufferSupport
?:
boolean
;
/**
* Whether to show a friendly error stack. Will decrease the performance significantly.
*/
showFriendlyErrorStack
?:
boolean
;
}
```
That's it!
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论