redis-client 0.22.2 → 0.31.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/CHANGELOG.md +100 -1
- data/README.md +60 -6
- data/lib/redis_client/circuit_breaker.rb +6 -3
- data/lib/redis_client/config.rb +81 -40
- data/lib/redis_client/connection_mixin.rb +29 -6
- data/lib/redis_client/hash_ring.rb +87 -0
- data/lib/redis_client/pooled.rb +2 -2
- data/lib/redis_client/ruby_connection/buffered_io.rb +10 -2
- data/lib/redis_client/ruby_connection/resp3.rb +2 -36
- data/lib/redis_client/ruby_connection.rb +23 -21
- data/lib/redis_client/sentinel_config.rb +27 -6
- data/lib/redis_client/version.rb +1 -1
- data/lib/redis_client.rb +141 -19
- metadata +4 -11
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -72
- data/Rakefile +0 -126
- data/redis-client.gemspec +0 -32
data/Gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
# Specify your gem's dependencies in redis-client.gemspec
|
|
6
|
-
gemspec name: "redis-client"
|
|
7
|
-
|
|
8
|
-
gem "minitest"
|
|
9
|
-
gem "rake", "~> 13.2"
|
|
10
|
-
gem "rake-compiler"
|
|
11
|
-
gem "rubocop"
|
|
12
|
-
gem "rubocop-minitest"
|
|
13
|
-
gem "toxiproxy"
|
|
14
|
-
|
|
15
|
-
group :benchmark do
|
|
16
|
-
gem "benchmark-ips"
|
|
17
|
-
gem "hiredis"
|
|
18
|
-
gem "redis", "~> 4.6"
|
|
19
|
-
gem "stackprof", platform: :mri
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
gem "byebug", platform: :mri
|
data/Gemfile.lock
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
redis-client (0.22.2)
|
|
5
|
-
connection_pool
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
ast (2.4.2)
|
|
11
|
-
benchmark-ips (2.13.0)
|
|
12
|
-
byebug (11.1.3)
|
|
13
|
-
connection_pool (2.4.1)
|
|
14
|
-
hiredis (0.6.3)
|
|
15
|
-
hiredis (0.6.3-java)
|
|
16
|
-
json (2.7.1)
|
|
17
|
-
json (2.7.1-java)
|
|
18
|
-
minitest (5.23.0)
|
|
19
|
-
parallel (1.24.0)
|
|
20
|
-
parser (3.3.0.5)
|
|
21
|
-
ast (~> 2.4.1)
|
|
22
|
-
racc
|
|
23
|
-
racc (1.7.3)
|
|
24
|
-
racc (1.7.3-java)
|
|
25
|
-
rainbow (3.1.1)
|
|
26
|
-
rake (13.2.1)
|
|
27
|
-
rake-compiler (1.2.7)
|
|
28
|
-
rake
|
|
29
|
-
redis (4.6.0)
|
|
30
|
-
regexp_parser (2.9.0)
|
|
31
|
-
rexml (3.2.6)
|
|
32
|
-
rubocop (1.50.2)
|
|
33
|
-
json (~> 2.3)
|
|
34
|
-
parallel (~> 1.10)
|
|
35
|
-
parser (>= 3.2.0.0)
|
|
36
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
37
|
-
regexp_parser (>= 1.8, < 3.0)
|
|
38
|
-
rexml (>= 3.2.5, < 4.0)
|
|
39
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
|
40
|
-
ruby-progressbar (~> 1.7)
|
|
41
|
-
unicode-display_width (>= 2.4.0, < 3.0)
|
|
42
|
-
rubocop-ast (1.30.0)
|
|
43
|
-
parser (>= 3.2.1.0)
|
|
44
|
-
rubocop-minitest (0.30.0)
|
|
45
|
-
rubocop (>= 1.39, < 2.0)
|
|
46
|
-
ruby-progressbar (1.13.0)
|
|
47
|
-
stackprof (0.2.26)
|
|
48
|
-
toxiproxy (2.0.2)
|
|
49
|
-
unicode-display_width (2.5.0)
|
|
50
|
-
|
|
51
|
-
PLATFORMS
|
|
52
|
-
ruby
|
|
53
|
-
universal-java-18
|
|
54
|
-
x86_64-darwin-20
|
|
55
|
-
x86_64-linux
|
|
56
|
-
|
|
57
|
-
DEPENDENCIES
|
|
58
|
-
benchmark-ips
|
|
59
|
-
byebug
|
|
60
|
-
hiredis
|
|
61
|
-
minitest
|
|
62
|
-
rake (~> 13.2)
|
|
63
|
-
rake-compiler
|
|
64
|
-
redis (~> 4.6)
|
|
65
|
-
redis-client!
|
|
66
|
-
rubocop
|
|
67
|
-
rubocop-minitest
|
|
68
|
-
stackprof
|
|
69
|
-
toxiproxy
|
|
70
|
-
|
|
71
|
-
BUNDLED WITH
|
|
72
|
-
2.3.13
|
data/Rakefile
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rake/extensiontask"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
require 'rubocop/rake_task'
|
|
6
|
-
|
|
7
|
-
RuboCop::RakeTask.new
|
|
8
|
-
|
|
9
|
-
require "rake/clean"
|
|
10
|
-
CLOBBER.include "pkg"
|
|
11
|
-
require "bundler/gem_helper"
|
|
12
|
-
Bundler::GemHelper.install_tasks(name: "redis-client")
|
|
13
|
-
Bundler::GemHelper.install_tasks(dir: "hiredis-client", name: "hiredis-client")
|
|
14
|
-
|
|
15
|
-
gemspec = Gem::Specification.load("redis-client.gemspec")
|
|
16
|
-
Rake::ExtensionTask.new do |ext|
|
|
17
|
-
ext.name = "hiredis_connection"
|
|
18
|
-
ext.ext_dir = "hiredis-client/ext/redis_client/hiredis"
|
|
19
|
-
ext.lib_dir = "hiredis-client/lib/redis_client"
|
|
20
|
-
ext.gem_spec = gemspec
|
|
21
|
-
CLEAN.add("#{ext.ext_dir}/vendor/*.{a,o}")
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
namespace :test do
|
|
25
|
-
Rake::TestTask.new(:ruby) do |t|
|
|
26
|
-
t.libs << "test"
|
|
27
|
-
t.libs << "lib"
|
|
28
|
-
t.test_files = FileList["test/**/*_test.rb"].exclude("test/sentinel/*_test.rb")
|
|
29
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
Rake::TestTask.new(:sentinel) do |t|
|
|
33
|
-
t.libs << "test/sentinel"
|
|
34
|
-
t.libs << "test"
|
|
35
|
-
t.libs << "lib"
|
|
36
|
-
t.test_files = FileList["test/sentinel/*_test.rb"]
|
|
37
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
Rake::TestTask.new(:hiredis) do |t|
|
|
41
|
-
t.libs << "test/hiredis"
|
|
42
|
-
t.libs << "test"
|
|
43
|
-
t.libs << "hiredis-client/lib"
|
|
44
|
-
t.libs << "lib"
|
|
45
|
-
t.test_files = FileList["test/**/*_test.rb"].exclude("test/sentinel/*_test.rb")
|
|
46
|
-
t.options = '-v' if ENV['CI'] || ENV['VERBOSE']
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
hiredis_supported = RUBY_ENGINE == "ruby" && !RUBY_PLATFORM.match?(/mswin/)
|
|
51
|
-
if hiredis_supported
|
|
52
|
-
task test: %i[test:ruby test:hiredis test:sentinel]
|
|
53
|
-
else
|
|
54
|
-
task test: %i[test:ruby test:sentinel]
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
namespace :hiredis do
|
|
58
|
-
task :download do
|
|
59
|
-
version = "1.0.2"
|
|
60
|
-
archive_path = "tmp/hiredis-#{version}.tar.gz"
|
|
61
|
-
url = "https://github.com/redis/hiredis/archive/refs/tags/v#{version}.tar.gz"
|
|
62
|
-
system("curl", "-L", url, out: archive_path) or raise "Downloading of #{url} failed"
|
|
63
|
-
system("rm", "-rf", "hiredis-client/ext/redis_client/hiredis/vendor/")
|
|
64
|
-
system("mkdir", "-p", "hiredis-client/ext/redis_client/hiredis/vendor/")
|
|
65
|
-
system(
|
|
66
|
-
"tar", "xvzf", archive_path,
|
|
67
|
-
"-C", "hiredis-client/ext/redis_client/hiredis/vendor",
|
|
68
|
-
"--strip-components", "1",
|
|
69
|
-
)
|
|
70
|
-
system("rm", "-rf", "hiredis-client/ext/redis_client/hiredis/vendor/examples")
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
benchmark_suites = %w(single pipelined drivers)
|
|
75
|
-
benchmark_modes = %i[ruby yjit hiredis]
|
|
76
|
-
namespace :benchmark do
|
|
77
|
-
benchmark_suites.each do |suite|
|
|
78
|
-
benchmark_modes.each do |mode|
|
|
79
|
-
next if suite == "drivers" && mode == :hiredis
|
|
80
|
-
|
|
81
|
-
name = "#{suite}_#{mode}"
|
|
82
|
-
desc name
|
|
83
|
-
task name do
|
|
84
|
-
output_path = "benchmark/#{name}.md"
|
|
85
|
-
sh "rm", "-f", output_path
|
|
86
|
-
File.open(output_path, "w+") do |output|
|
|
87
|
-
output.puts("ruby: `#{RUBY_DESCRIPTION}`\n\n")
|
|
88
|
-
output.puts("redis-server: `#{`redis-server -v`.strip}`\n\n")
|
|
89
|
-
output.puts
|
|
90
|
-
output.flush
|
|
91
|
-
env = {}
|
|
92
|
-
args = []
|
|
93
|
-
args << "--yjit" if mode == :yjit
|
|
94
|
-
env["DRIVER"] = mode == :hiredis ? "hiredis" : "ruby"
|
|
95
|
-
system(env, RbConfig.ruby, *args, "benchmark/#{suite}.rb", out: output)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
skipping = false
|
|
99
|
-
output = File.readlines(output_path).reject do |line|
|
|
100
|
-
if skipping
|
|
101
|
-
if line == "Comparison:\n"
|
|
102
|
-
skipping = false
|
|
103
|
-
true
|
|
104
|
-
else
|
|
105
|
-
skipping
|
|
106
|
-
end
|
|
107
|
-
else
|
|
108
|
-
skipping = true if line.start_with?("Warming up ---")
|
|
109
|
-
skipping
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
File.write(output_path, output.join)
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
task all: benchmark_suites.flat_map { |s| benchmark_modes.flat_map { |m| "#{s}_#{m}" } }
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
if hiredis_supported
|
|
121
|
-
task default: %i[compile test rubocop]
|
|
122
|
-
task ci: %i[compile test:ruby test:hiredis]
|
|
123
|
-
else
|
|
124
|
-
task default: %i[test rubocop]
|
|
125
|
-
task ci: %i[test:ruby]
|
|
126
|
-
end
|
data/redis-client.gemspec
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "lib/redis_client/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name = "redis-client"
|
|
7
|
-
spec.version = RedisClient::VERSION
|
|
8
|
-
spec.authors = ["Jean Boussier"]
|
|
9
|
-
spec.email = ["jean.boussier@gmail.com"]
|
|
10
|
-
|
|
11
|
-
spec.summary = "Simple low-level client for Redis 6+"
|
|
12
|
-
spec.homepage = "https://github.com/redis-rb/redis-client"
|
|
13
|
-
spec.license = "MIT"
|
|
14
|
-
spec.required_ruby_version = ">= 2.6.0"
|
|
15
|
-
|
|
16
|
-
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
|
17
|
-
|
|
18
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
|
19
|
-
spec.metadata["source_code_uri"] = spec.homepage
|
|
20
|
-
spec.metadata["changelog_uri"] = File.join(spec.homepage, "blob/master/CHANGELOG.md")
|
|
21
|
-
|
|
22
|
-
# Specify which files should be added to the gem when it is released.
|
|
23
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
|
25
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
|
26
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|hiredis-client|test|spec|features|benchmark)/|\.(?:git|rubocop))})
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
spec.require_paths = ["lib"]
|
|
30
|
-
|
|
31
|
-
spec.add_runtime_dependency "connection_pool"
|
|
32
|
-
end
|