You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This guide explains how to use the `async-redis` gem to connect to a Redis server and perform basic operations.
4
+
5
+
## Installation
6
+
7
+
Add the gem to your project:
8
+
9
+
```shell
10
+
$ bundle add async-redis
11
+
```
12
+
13
+
## Usage
14
+
15
+
### Basic Local Connection
16
+
17
+
```ruby
18
+
require'async/redis'
19
+
20
+
endpoint =Async::Redis.local_endpoint
21
+
client =Async::Redis::Client.new(endpoint)
22
+
23
+
Asyncdo
24
+
puts client.info
25
+
ensure
26
+
client.close
27
+
end
28
+
```
29
+
30
+
### Connecting to Redis SSL Endpoint
31
+
32
+
This example demonstrates parsing an environment variable with a `redis://` or SSL `rediss://` scheme, and demonstrates how you can specify SSL parameters on the SSLContext object.
This example demonstrates parsing an environment variable with a `redis://` or SSL `rediss://` scheme, and demonstrates how you can specify SSL parameters on the SSLContext object.
Please see the [project documentation](https://github.com/socketry/async-redis) for more details.
86
10
87
-
Asyncdo |task|
88
-
condition =Async::Condition.new
89
-
90
-
publisher = task.async do
91
-
condition.wait
92
-
93
-
client.publish 'status.frontend', 'good'
94
-
end
95
-
96
-
subscriber = task.async do
97
-
client.subscribe 'status.frontend'do |context|
98
-
condition.signal # We are waiting for messages.
99
-
100
-
type, name, message = context.listen
101
-
102
-
pp type, name, message
103
-
end
104
-
end
105
-
ensure
106
-
client.close
107
-
end
108
-
```
11
+
-[Getting Started](https://github.com/socketry/async-redisguides/getting-started/index) - This guide explains how to use the `async-redis` gem to connect to a Redis server and perform basic operations.
0 commit comments