You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ji...@apache.org on 2022/04/24 18:51:44 UTC

[incubator-brpc] branch master updated: Add redis auth doc

This is an automated email from the ASF dual-hosted git repository.

jiashunzhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 6befc602 Add redis auth doc
     new 888a10b3 Merge pull request #1750 from wwbmmm/redis_auth_doc
6befc602 is described below

commit 6befc602ad1fa9e94bf9bdd339be9f6519315735
Author: wwbmmm <ww...@163.com>
AuthorDate: Sun Apr 24 16:33:31 2022 +0800

    Add redis auth doc
---
 docs/cn/redis_client.md | 10 ++++++++++
 docs/en/redis_client.md | 11 +++++++++++
 2 files changed, 21 insertions(+)

diff --git a/docs/cn/redis_client.md b/docs/cn/redis_client.md
index c39dce5f..c0abbe62 100644
--- a/docs/cn/redis_client.md
+++ b/docs/cn/redis_client.md
@@ -104,6 +104,16 @@ CHECK_EQ(10, response.reply(2).integer());
 CHECK_EQ(-10, response.reply(3).integer());
 ```
 
+# 访问带认证的Redis
+
+创建一个RedisAuthenticator,并设置到ChannelOptions里即可。
+
+```c++
+brpc::ChannelOptions options;
+brpc::policy::RedisAuthenticator* auth = new brpc::policy::RedisAuthenticator("my_password");
+options.auth = auth;
+```
+
 # RedisRequest
 
 一个[RedisRequest](https://github.com/brpc/brpc/blob/master/src/brpc/redis.h)可包含多个Command,调用AddCommand*增加命令,成功返回true,失败返回false**并会打印调用处的栈**。
diff --git a/docs/en/redis_client.md b/docs/en/redis_client.md
index 11b65b78..00c19c5b 100644
--- a/docs/en/redis_client.md
+++ b/docs/en/redis_client.md
@@ -104,6 +104,17 @@ CHECK_EQ(10, response.reply(2).integer());
 CHECK_EQ(-10, response.reply(3).integer());
 ```
 
+# Request redis with authenticator
+
+Create a RedisAuthenticator, and set to ChannelOptions.
+
+```c++
+brpc::ChannelOptions options;
+brpc::policy::RedisAuthenticator* auth = new brpc::policy::RedisAuthenticator("my_password");
+options.auth = auth;
+```
+
+
 # RedisRequest
 
 A [RedisRequest](https://github.com/brpc/brpc/blob/master/src/brpc/redis.h) may contain multiple commands by calling `AddCommand*`, which returns true on success and false otherwise. **The callsite backtrace is also printed on error**.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org