async-redis 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/async/redis/client.rb +3 -2
- data/lib/async/redis/context/pipeline.rb +1 -1
- data/lib/async/redis/context/subscribe.rb +8 -28
- data/lib/async/redis/version.rb +1 -1
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8d65ffd87c3fc39ff159a221f15997ff90faa2935cc4f6b80c8d919a13ea909
|
4
|
+
data.tar.gz: 385cf65139987431ba3dd99ffbcec12cd27d07597363126eb4e3778f8101f862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd608d404017e9f11af979a5645da7428e12845e7b1e01e4726679600a7ada84eb2499fa71e7fd26d9eb314e1e92ed837381f8083b7ffb06ea2f34df24225051
|
7
|
+
data.tar.gz: 1b747b2123d64c0af6f63ed46e17e9bec20b32e415e847fd375fe5e22bd407855ff57cf72d76c896fe654c2f3400e2a38e47be5c1a0125722386faa1c1594176
|
data/lib/async/redis/client.rb
CHANGED
@@ -44,7 +44,7 @@ module Async
|
|
44
44
|
class Client
|
45
45
|
include ::Protocol::Redis::Methods
|
46
46
|
|
47
|
-
def initialize(endpoint = Redis.local_endpoint, protocol
|
47
|
+
def initialize(endpoint = Redis.local_endpoint, protocol: Protocol::RESP2, **options)
|
48
48
|
@endpoint = endpoint
|
49
49
|
@protocol = protocol
|
50
50
|
|
@@ -131,7 +131,8 @@ module Async
|
|
131
131
|
Async::Pool::Controller.wrap(**options) do
|
132
132
|
peer = @endpoint.connect
|
133
133
|
|
134
|
-
|
134
|
+
# We will manage flushing ourselves:
|
135
|
+
peer.sync = true
|
135
136
|
|
136
137
|
stream = IO::Stream.new(peer)
|
137
138
|
|
@@ -27,11 +27,11 @@ module Async
|
|
27
27
|
module Redis
|
28
28
|
module Context
|
29
29
|
class Subscribe < Generic
|
30
|
+
MESSAGE = 'message'
|
31
|
+
|
30
32
|
def initialize(pool, channels)
|
31
33
|
super(pool)
|
32
34
|
|
33
|
-
@channels = channels
|
34
|
-
|
35
35
|
subscribe(channels)
|
36
36
|
end
|
37
37
|
|
@@ -43,39 +43,19 @@ module Async
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def listen
|
46
|
-
|
46
|
+
while response = @connection.read_response
|
47
|
+
return response if response.first == MESSAGE
|
48
|
+
end
|
47
49
|
end
|
48
50
|
|
49
|
-
private
|
50
|
-
|
51
51
|
def subscribe(channels)
|
52
52
|
@connection.write_request ['SUBSCRIBE', *channels]
|
53
53
|
@connection.flush
|
54
|
-
|
55
|
-
response = nil
|
56
|
-
|
57
|
-
channels.length.times do |i|
|
58
|
-
response = @connection.read_response
|
59
|
-
end
|
60
|
-
|
61
|
-
return response
|
62
54
|
end
|
63
55
|
|
64
|
-
def unsubscribe(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
response = nil
|
69
|
-
|
70
|
-
@channels.length.times do |i|
|
71
|
-
response = @connection.read_response
|
72
|
-
end
|
73
|
-
|
74
|
-
return response
|
75
|
-
else
|
76
|
-
@channels.subtract(channels)
|
77
|
-
return call('UNSUBSCRIBE', *channels)
|
78
|
-
end
|
56
|
+
def unsubscribe(channels)
|
57
|
+
@connection.write_request ['UNSUBSCRIBE', *channels]
|
58
|
+
@connection.flush
|
79
59
|
end
|
80
60
|
end
|
81
61
|
end
|
data/lib/async/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,30 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Huba Nagy
|
9
|
+
- David Ortiz
|
10
|
+
- Gleb Sinyavskiy
|
11
|
+
- Troex Nevelin
|
12
|
+
- Jeremy Jung
|
13
|
+
- Mika Hel
|
14
|
+
- Mikael Henriksson
|
15
|
+
- Olle Jonsson
|
16
|
+
- Salim Semaoune
|
17
|
+
- Tim Willard
|
18
|
+
- k1tsu
|
19
|
+
- machty
|
9
20
|
autorequire:
|
10
21
|
bindir: bin
|
11
22
|
cert_chain: []
|
12
|
-
date:
|
23
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
13
24
|
dependencies:
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: async
|
16
27
|
requirement: !ruby/object:Gem::Requirement
|
17
28
|
requirements:
|
18
|
-
- - "
|
29
|
+
- - ">="
|
19
30
|
- !ruby/object:Gem::Version
|
20
31
|
version: '1.8'
|
32
|
+
- - "<"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '3.0'
|
21
35
|
type: :runtime
|
22
36
|
prerelease: false
|
23
37
|
version_requirements: !ruby/object:Gem::Requirement
|
24
38
|
requirements:
|
25
|
-
- - "
|
39
|
+
- - ">="
|
26
40
|
- !ruby/object:Gem::Version
|
27
41
|
version: '1.8'
|
42
|
+
- - "<"
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '3.0'
|
28
45
|
- !ruby/object:Gem::Dependency
|
29
46
|
name: async-io
|
30
47
|
requirement: !ruby/object:Gem::Requirement
|
@@ -214,7 +231,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
231
|
- !ruby/object:Gem::Version
|
215
232
|
version: '0'
|
216
233
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
234
|
+
rubygems_version: 3.3.7
|
218
235
|
signing_key:
|
219
236
|
specification_version: 4
|
220
237
|
summary: A Redis client library.
|