Skip to content
Permalink
Browse files
Merge pull request #1750 from wwbmmm/redis_auth_doc
Add redis auth doc
  • Loading branch information
zyearn committed Apr 24, 2022
2 parents 51a818e + 6befc60 commit 888a10b3b27f2c475cd6c133b2de546b403a005f
Showing 2 changed files with 21 additions and 0 deletions.
@@ -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**并会打印调用处的栈**。
@@ -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**.

0 comments on commit 888a10b

Please sign in to comment.