async-redis 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -5
- data/Gemfile +0 -5
- data/Rakefile +12 -0
- data/async-redis.gemspec +1 -0
- data/lib/async/redis/client.rb +10 -5
- data/lib/async/redis/methods/server.rb +4 -0
- data/lib/async/redis/pool.rb +0 -1
- data/lib/async/redis/protocol/resp.rb +20 -0
- data/lib/async/redis/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4908d7f5eef4279d5be275a46c17feb0d453f4c6bbc6e2cfa026eef027e518cc
|
4
|
+
data.tar.gz: 2dc99ed8cc6b160656b370a413118083787808104097382a7eac4e50b6cbb1be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81bb8852f240c15d49670753acd9a1edba37911fd51c1594431e977d5e6b9bf8c31599523a5ce5a7c925b3674db5788bc2e764b0261ba43c07de67bf41822878
|
7
|
+
data.tar.gz: 2eb751bbc41d0a043139f19a33b031e3f40de3915f8e8c82b1e3cae3edab409689aaab0b73714a75fa96bfadb566bbfd1138478faf034c7e31fc5f3404877cb7
|
data/.travis.yml
CHANGED
@@ -11,14 +11,13 @@ matrix:
|
|
11
11
|
- rvm: 2.4
|
12
12
|
- rvm: 2.5
|
13
13
|
- rvm: 2.6
|
14
|
+
- rvm: 2.6
|
15
|
+
env: COVERAGE=BriefSummary,Coveralls
|
16
|
+
- rvm: ruby-head
|
14
17
|
- rvm: truffleruby
|
15
18
|
- rvm: jruby-head
|
16
19
|
env: JRUBY_OPTS="--debug -X+O"
|
17
|
-
- rvm: ruby-head
|
18
|
-
- rvm: rbx-3
|
19
20
|
allow_failures:
|
20
|
-
- rvm: truffleruby
|
21
21
|
- rvm: ruby-head
|
22
|
-
- rvm: jruby-head
|
23
22
|
- rvm: truffleruby
|
24
|
-
- rvm:
|
23
|
+
- rvm: jruby-head
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -4,3 +4,15 @@ require "rspec/core/rake_task"
|
|
4
4
|
RSpec::Core::RakeTask.new(:test)
|
5
5
|
|
6
6
|
task :default => :test
|
7
|
+
|
8
|
+
task :client do
|
9
|
+
require 'irb'
|
10
|
+
require 'async/redis/client'
|
11
|
+
|
12
|
+
endpoint = Async::Redis.local_endpoint
|
13
|
+
client = Async::Redis::Client.new(endpoint)
|
14
|
+
|
15
|
+
Async do
|
16
|
+
binding.irb
|
17
|
+
end
|
18
|
+
end
|
data/async-redis.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "async-rspec", "~> 1.1"
|
24
24
|
|
25
|
+
spec.add_development_dependency "covered"
|
25
26
|
spec.add_development_dependency "bundler"
|
26
27
|
spec.add_development_dependency "rspec", "~> 3.6"
|
27
28
|
spec.add_development_dependency "rake"
|
data/lib/async/redis/client.rb
CHANGED
@@ -52,16 +52,20 @@ module Async
|
|
52
52
|
attr :endpoint
|
53
53
|
attr :protocol
|
54
54
|
|
55
|
+
# @return [client] if no block provided.
|
56
|
+
# @yield [client, task] yield the client in an async task.
|
55
57
|
def self.open(*args, &block)
|
56
58
|
client = self.new(*args)
|
57
59
|
|
58
60
|
return client unless block_given?
|
59
61
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
Async do |task|
|
63
|
+
begin
|
64
|
+
yield client, task
|
65
|
+
ensure
|
66
|
+
client.close
|
67
|
+
end
|
68
|
+
end.wait
|
65
69
|
end
|
66
70
|
|
67
71
|
def close
|
@@ -99,6 +103,7 @@ module Async
|
|
99
103
|
def call(*arguments)
|
100
104
|
@pool.acquire do |connection|
|
101
105
|
connection.write_request(arguments)
|
106
|
+
|
102
107
|
return connection.read_response
|
103
108
|
end
|
104
109
|
end
|
data/lib/async/redis/pool.rb
CHANGED
@@ -121,6 +121,26 @@ module Async
|
|
121
121
|
end
|
122
122
|
|
123
123
|
alias read_response read_object
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
# Override Async::IO::Protocol::Line#write_line
|
128
|
+
# The original method performs a flush. This one does not and moves the
|
129
|
+
# responsibility of flushing to the caller of the method.
|
130
|
+
# In the case of Redis, we do not want to perform a flush in every line,
|
131
|
+
# because each Redis command contains several lines. Flushing once per
|
132
|
+
# command is more efficient because it avoids unnecessary writes to the
|
133
|
+
# socket.
|
134
|
+
def write_lines(*args)
|
135
|
+
if args.empty?
|
136
|
+
@stream.write(@eol)
|
137
|
+
else
|
138
|
+
args.each do |arg|
|
139
|
+
@stream.write(arg)
|
140
|
+
@stream.write(@eol)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
124
144
|
end
|
125
145
|
end
|
126
146
|
end
|
data/lib/async/redis/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-02-
|
12
|
+
date: 2019-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: async
|
@@ -53,6 +53,20 @@ dependencies:
|
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '1.1'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: covered
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
56
70
|
- !ruby/object:Gem::Dependency
|
57
71
|
name: bundler
|
58
72
|
requirement: !ruby/object:Gem::Requirement
|